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 +4 -4
- data/lib/lita/handlers/puppet.rb +47 -36
- data/lita-puppet.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13f87adb8fc368b1d5fc3131f104779fe867b005
|
4
|
+
data.tar.gz: 3992ae7a580ce8a977ae31f42d90213c929fcf78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 271ffa1c3b9e009a0f022b8dd4e314f7ce3073b512393dbafec59d9f7d3d43b68035fd7965e9a9e89ccc2032a25d978765ffb31bed493ec178bbc2a9753aa572
|
7
|
+
data.tar.gz: 21e6c2183d92f170fc6a4247e15598bed72e58e4d8291cd7a8e6b973c0cd4e45ccdd732733c2c65fd304658988dfa8c98721cfd95b9c16564912e40f4b7d3efc
|
data/lib/lita/handlers/puppet.rb
CHANGED
@@ -35,31 +35,36 @@ module Lita
|
|
35
35
|
ret = nil
|
36
36
|
|
37
37
|
# TODO: better error handling
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
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 "
|
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
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
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