lita-puppet 2.1.4 → 2.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -2
- data/.travis.yml +1 -1
- data/lib/lita-puppet.rb +1 -0
- data/lib/lita/handlers/puppet.rb +11 -1
- data/lita-puppet.gemspec +1 -1
- data/locales/en.yml +1 -0
- data/spec/lita/handlers/puppet_spec.rb +9 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8becf5247bbd3296019d1ee1940b856fbffc0ab8
|
4
|
+
data.tar.gz: 2f53802c6f4505aa8a48071bdc2756c967630a56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2cadbf6b61bd758d6c92769eb9d6f0e4ca592649dd247b96cdcf54913471978d6303e62e1c6684698c20cacf1558b865c104859e49f6e0a2bd686a27261501d1
|
7
|
+
data.tar.gz: ee73cac7096ee78f7c3f8ec00baa925a1e93097e6db7aba678149d67206dcf1beecdb9fb38e1b37eb32e9cfb0abdeaea87b4544b84d19681cdf7d82b5f0388b5
|
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
data/lib/lita-puppet.rb
CHANGED
data/lib/lita/handlers/puppet.rb
CHANGED
@@ -87,8 +87,18 @@ module Lita
|
|
87
87
|
def puppet_agent_run(response)
|
88
88
|
host = response.matches[0][4]
|
89
89
|
|
90
|
-
|
90
|
+
resolvable = begin
|
91
|
+
Resolv.getaddress(host)
|
92
|
+
rescue Resolv::ResolvError
|
93
|
+
false
|
94
|
+
end
|
91
95
|
|
96
|
+
unless resolvable
|
97
|
+
response.reply_with_mention(t('replies.puppet_agent_run.dns_failure', machine: host))
|
98
|
+
return false
|
99
|
+
end
|
100
|
+
|
101
|
+
response.reply_with_mention(t('replies.puppet_agent_run.working'))
|
92
102
|
result = simple_ssh_command(host, config.ssh_user, agent_command)
|
93
103
|
|
94
104
|
# build a reply
|
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 = '2.1.
|
3
|
+
spec.version = '2.1.5'
|
4
4
|
spec.authors = ['Daniel Schaaff', 'Jonathan Gnagy'].sort
|
5
5
|
spec.email = ['jgnagy@knuedge.com']
|
6
6
|
spec.description = 'Some basic Puppet interactions for Lita'
|
data/locales/en.yml
CHANGED
@@ -32,6 +32,7 @@ en:
|
|
32
32
|
puppet_agent_run:
|
33
33
|
working: "I'll run puppet right away. Give me a sec and I'll let you know how it goes."
|
34
34
|
failure: "your puppet run is done, but didn't seem to work... I think it may have timed out."
|
35
|
+
dns_failure: "I couldn't find a machine called '%{machine}'."
|
35
36
|
success: "that puppet run is complete! It exited with status %{status}."
|
36
37
|
node_profiles:
|
37
38
|
notconf: "I would do that, but I don't know how to connect to PuppetDB. Edit my config and add `config.handlers.puppet.puppetdb_url`."
|
@@ -112,15 +112,22 @@ describe Lita::Handlers::Puppet, lita_handler: true do
|
|
112
112
|
before do
|
113
113
|
robot.auth.add_user_to_group!(lita_user, :puppet_admins)
|
114
114
|
end
|
115
|
-
|
115
|
+
|
116
|
+
it 'notifies users when server names are not resolvable' do
|
116
117
|
allow(Rye::Box).to receive(:new).and_return(rye_box)
|
117
118
|
send_command('puppet agent run on server.name', as: lita_user)
|
119
|
+
expect(replies[-1]).to eq('I couldn\'t find a machine called \'server.name\'.')
|
120
|
+
end
|
121
|
+
|
122
|
+
it 'should run a puppet agent' do
|
123
|
+
allow(Rye::Box).to receive(:new).and_return(rye_box)
|
124
|
+
send_command('puppet agent run on localhost', as: lita_user)
|
118
125
|
expect(replies[-2]).to eq('that puppet run is complete! It exited with status 0.')
|
119
126
|
end
|
120
127
|
|
121
128
|
it 'should truncate long results' do
|
122
129
|
allow(Rye::Box).to receive(:new).and_return(rye_box)
|
123
|
-
send_command('puppet agent run on
|
130
|
+
send_command('puppet agent run on localhost', as: lita_user)
|
124
131
|
expect(replies[-1].lines.last).to eq('... truncated to 50 lines')
|
125
132
|
expect(replies[-1].lines.size).to eq(51)
|
126
133
|
end
|
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: 2.1.
|
4
|
+
version: 2.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Schaaff
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-06-
|
12
|
+
date: 2017-06-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: lita
|