lita-puppet 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 74f14f63bbb88c1f79aa44caa0555802f90c3c3c
4
- data.tar.gz: 37d828c7b031c2a3a6680eda01256fe556e6b435
3
+ metadata.gz: 13f87adb8fc368b1d5fc3131f104779fe867b005
4
+ data.tar.gz: 3992ae7a580ce8a977ae31f42d90213c929fcf78
5
5
  SHA512:
6
- metadata.gz: e40db9417df26a0640e0b753d917cd215f2d1f8538b4b155df02fca324e84ee22e5c2b2629330a55e43763a24b975ffd9d03424813e91550ced3dd7bafdf2bc4
7
- data.tar.gz: 17c70bacceb0b49fba1dddee48c5cd81a5185af8f7deb6e0f06b2ddd651acb2c45b94601d31ec35f309b9d8c7d653c4c7b3114b3a2ece5baf3876031a29e3b72
6
+ metadata.gz: 271ffa1c3b9e009a0f022b8dd4e314f7ce3073b512393dbafec59d9f7d3d43b68035fd7965e9a9e89ccc2032a25d978765ffb31bed493ec178bbc2a9753aa572
7
+ data.tar.gz: 21e6c2183d92f170fc6a4247e15598bed72e58e4d8291cd7a8e6b973c0cd4e45ccdd732733c2c65fd304658988dfa8c98721cfd95b9c16564912e40f4b7d3efc
@@ -35,31 +35,36 @@ module Lita
35
35
  ret = nil
36
36
 
37
37
  # TODO: better error handling
38
-
39
- Timeout::timeout(600) do
40
- puppet_master = Rye::Box.new(config.master_hostname, user: user)
41
- puppet_master.cd control_repo
42
-
43
- # Need to use sudo from here on
44
- puppet_master.enable_sudo
45
-
46
- puppet_master.git :pull
47
-
48
- # scary...
49
- puppet_master.disable_safe_mode
50
- command = "r10k deploy environment"
51
- command << " #{environment}" if environment
52
- command << ' -pv'
53
- ret = puppet_master.execute command
38
+ puppet_master = Rye::Box.new(config.master_hostname, user: user, password_prompt: false)
39
+ begin
40
+ Timeout::timeout(600) do
41
+ puppet_master.cd control_repo
42
+
43
+ # Need to use sudo from here on
44
+ puppet_master.enable_sudo
45
+
46
+ puppet_master.git :pull
47
+
48
+ # scary...
49
+ puppet_master.disable_safe_mode
50
+ command = "r10k deploy environment"
51
+ command << " #{environment}" if environment
52
+ command << ' -pv'
53
+ ret = puppet_master.execute command
54
+ end
55
+ rescue Exception => e
56
+ exception = e
57
+ ensure
54
58
  puppet_master.disconnect
55
59
  end
56
60
 
57
61
  # build a reply
58
- response.reply("#{username}, your r10k deployment is done!")
59
62
  if ret
63
+ response.reply("#{username}, your r10k deployment is done!")
60
64
  response.reply "/code " + ret.stderr.join("\n")
61
65
  else
62
- response.reply "But didn't seem to work... I think it may have timed out."
66
+ response.reply "#{username}, your r10k run didn't seem to work... I think it may have timed out."
67
+ response.reply "/code " + exception.message
63
68
  end
64
69
  end
65
70
 
@@ -71,26 +76,31 @@ module Lita
71
76
  response.reply("#{username}, I'll run puppet right away. Give me a sec and I'll let you know how it goes.")
72
77
 
73
78
  ret = nil
79
+ exception = nil
74
80
 
75
81
  # TODO: better error handling
76
-
77
- Timeout::timeout(300) do
78
- remote = Rye::Box.new(host, user: user)
79
- remote.cd '/tmp'
80
-
81
- # Need to use sudo from here on
82
- remote.enable_sudo
83
-
84
- # scary...
85
- remote.disable_safe_mode
86
-
87
- # build up the command
88
- command = 'puppet agent'
89
- command << ' --verbose --no-daemonize'
90
- command << ' --no-usecacheonfailure'
91
- command << ' --no-splay --show_diff'
92
-
93
- ret = remote.execute command
82
+ remote = Rye::Box.new(host, user: user, password_prompt: false)
83
+ begin
84
+ Timeout::timeout(300) do
85
+ remote.cd '/tmp'
86
+
87
+ # Need to use sudo from here on
88
+ remote.enable_sudo
89
+
90
+ # scary...
91
+ remote.disable_safe_mode
92
+
93
+ # build up the command
94
+ command = 'puppet agent'
95
+ command << ' --verbose --no-daemonize'
96
+ command << ' --no-usecacheonfailure'
97
+ command << ' --no-splay --show_diff'
98
+
99
+ ret = remote.execute command
100
+ end
101
+ rescue Exception => e
102
+ exception = e
103
+ ensure
94
104
  remote.disconnect
95
105
  end
96
106
 
@@ -101,6 +111,7 @@ module Lita
101
111
  response.reply "/code " + ret.stdout.join("\n").gsub(/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]/, '')
102
112
  else
103
113
  response.reply "#{username}, your puppet run is done, but didn't seem to work... I think it may have timed out."
114
+ response.reply "/code " + exception.message
104
115
  end
105
116
  end
106
117
 
data/lita-puppet.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "lita-puppet"
3
- spec.version = "0.2.1"
3
+ spec.version = "0.2.2"
4
4
  spec.authors = ["Jonathan Gnagy"]
5
5
  spec.email = ["jgnagy@knuedge.com"]
6
6
  spec.description = "Some basic Puppet interactions for Lita"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-puppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Gnagy