runpuppet 0.5.13 → 0.5.14

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.13
1
+ 0.5.14
data/bin/runpuppet CHANGED
@@ -22,6 +22,7 @@ BANNER
22
22
  opts.on('-v', '--version','Show Version'){ puts Runpuppet::VERSION; exit}
23
23
  opts.on('--try','Runs only if selected on puppet_controller'){ options[:try] = true }
24
24
  opts.on('-f', '--facts','Report facts'){ options[:facts] = true }
25
+ opts.on('-vv', '--verbose','Verbose Output'){ options[:verbose] = true }
25
26
  opts.on('-b x', '--branch x', 'Run this branch') do |branch|
26
27
  options[:branch] = branch
27
28
  end
data/lib/runpuppet.rb CHANGED
@@ -34,11 +34,13 @@ class Runpuppet
34
34
  end
35
35
 
36
36
 
37
- def self.get(path)
37
+ def self.get(path, options={})
38
38
  path += (path.include?('?') ? '&' : '?')
39
39
  path += "hostname=#{Socket.gethostname}&ip=#{Config.local_ip}"
40
40
  begin
41
- open(Config.puppet_controller_url + path, {:http_basic_authentication =>Config.puppet_controller_auth} )
41
+ url = Config.puppet_controller_url + path
42
+ puts "Getting #{url}" if options[:verbose]
43
+ open(url , {:http_basic_authentication =>Config.puppet_controller_auth} )
42
44
  rescue Exception => e
43
45
  puts e.inspect
44
46
  puts "WARNING: error connecting to puppet controller!"
@@ -62,17 +64,18 @@ class Runpuppet
62
64
  with_lock(Config.lock_file) do
63
65
  time = Time.now.utc.strftime("%Y-%m-%d %H:%M:%S")
64
66
 
65
- todo, branch = get("/puppet/run").read.split('-') rescue []
67
+ todo, branch = get("/puppet/run", options).read.split('-') rescue []
68
+ puts "got #{todo} with branch #{branch}" if options[:verbose]
66
69
  branch ||= (options[:branch] || Config.default_branch)
67
70
  if todo == 'run' or !options[:try] # try allows not running
68
- get '/puppet/status?status=started'
71
+ get '/puppet/status?status=started', options
69
72
  cmd = Config.command.gsub('@@branch@@', branch)
70
73
  puts "#{time}: run #{branch}"
71
74
 
72
75
  if sh(cmd)
73
- get '/puppet/status?status=finished'
76
+ get '/puppet/status?status=finished', options
74
77
  else
75
- get '/puppet/status?status=error'
78
+ get '/puppet/status?status=error', options
76
79
  exit 2
77
80
  end
78
81
  else
data/runpuppet.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{runpuppet}
8
- s.version = "0.5.13"
8
+ s.version = "0.5.14"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = [%q{Roman Heinrich}]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runpuppet
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 13
10
- version: 0.5.13
9
+ - 14
10
+ version: 0.5.14
11
11
  platform: ruby
12
12
  authors:
13
13
  - Roman Heinrich