lita-puppet 0.5.5 → 0.6.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 71652e9e43f1a190a33ffe04320e3f89521668bb
4
- data.tar.gz: 43e091d0e1701c4061a76ac6f497f34b57f58f9f
3
+ metadata.gz: 19f5faac942550056a8e622b8772e076899582b4
4
+ data.tar.gz: 9dbf11d646540f12618c38ddd9a81e58a8f4284c
5
5
  SHA512:
6
- metadata.gz: 6de78f5ca3101630efe3a9634b2fb45432c737afc73edb6a33fd91b945edf2285a84380ca1cc3010438142ddebd806fd522d270d1929e09da2dd3b69430e426d
7
- data.tar.gz: 6cb0e7853f81ce64e3eaf8e602f4450600259d22b1bfc9b0aa6a139c720c6aa10e1d09a9cb4901408f0f6dc85d0cb5cb7f24645193c39296ec9a5fc592007343
6
+ metadata.gz: d6fb934ddce658daf2c9e554d06a5e29ad7582420cd1f272ca11afeb60cf3e73c53c96a5d5dda1f5af8dd4a505f2e23f36c78f2d132a13af1d8b0163b3984714
7
+ data.tar.gz: a4f7ca178ec3245a5300765a139e69d4fab76f0abc4b2cbf1775c7ec5f38436db05141495c5ca8685e4e640ac95dd0451b3a39ef1e3666d64c3db5ef03e464b3
data/README.md CHANGED
@@ -60,3 +60,12 @@ This is also available as:
60
60
  pp node <certname> profiles
61
61
 
62
62
  Where `<certname>` is the SSL certificate name used for Puppet. This is usually the FQDN for the host.
63
+
64
+ #### Query PuppetDB for the nodes associated with a class
65
+ puppet class nodes <class>
66
+
67
+ This is also available as:
68
+
69
+ pp class nodes <class>
70
+
71
+ Where `<class>` is a class name as it shows up in the catalog. Usually something like Role::Foo_bar
@@ -75,14 +75,14 @@ module Lita
75
75
 
76
76
  if result[:exception]
77
77
  response.reply "#{username}, your `puppet cert clean` didn't seem to work... ;-("
78
- response.reply "/code " + result[:exception].message
78
+ response.reply as_code(result[:exception].message)
79
79
  return false
80
80
  end
81
81
 
82
82
  # build a reply
83
83
  response.reply("#{username}, your `puppet cert clean` is all done!")
84
84
  reply_content = [result[:stdout].join("\n"), result[:stderr].join("\n")].join("\n")
85
- response.reply "/code " + sanitze_for_chat(reply_content)
85
+ response.reply as_code(reply_content)
86
86
  end
87
87
 
88
88
  def puppet_agent_run(response)
@@ -114,10 +114,10 @@ module Lita
114
114
  if !result[:exception]
115
115
  response.reply "#{username}, that puppet run is complete! It exited with status #{result[:exit_status]}."
116
116
  # Send the standard out, but strip off the bash color code stuff...
117
- response.reply "/code " + sanitze_for_chat(result[:stdout].join("\n"))
117
+ response.reply as_code(result[:stdout].join("\n"))
118
118
  else
119
119
  response.reply "#{username}, your puppet run is done, but didn't seem to work... I think it may have timed out."
120
- response.reply "/code " + result[:exception].message
120
+ response.reply as_code(result[:exception].message)
121
121
  end
122
122
  end
123
123
 
@@ -141,7 +141,7 @@ module Lita
141
141
  return false
142
142
  else
143
143
  response.reply("Here are the profiles and roles for #{host}:")
144
- response.reply("/code" + profiles.join("\n"))
144
+ response.reply as_code(profiles.join("\n"))
145
145
  end
146
146
  end
147
147
 
@@ -165,7 +165,7 @@ module Lita
165
165
  return false
166
166
  else
167
167
  response.reply("Here are all the nodes with class #{puppet_class}:")
168
- response.reply("/code" + puppet_classes.join("\n"))
168
+ response.reply as_code(puppet_classes.join("\n"))
169
169
  end
170
170
  end
171
171
 
@@ -187,7 +187,7 @@ module Lita
187
187
 
188
188
  if result1[:exception]
189
189
  response.reply "#{username}, your r10k run didn't seem to work. Looks like there was a problem with Git:"
190
- response.reply "/code " + result1[:exception].message
190
+ response.reply as_code(result1[:exception].message)
191
191
  return false
192
192
  end
193
193
 
@@ -213,14 +213,14 @@ module Lita
213
213
 
214
214
  if result2[:exception]
215
215
  response.reply "#{username}, your r10k run didn't seem to work... Maybe it timed out?"
216
- response.reply "/code " + result2[:exception].message
216
+ response.reply as_code(result2[:exception].message)
217
217
  return false
218
218
  end
219
219
 
220
220
  # build a reply
221
221
  response.reply("#{username}, your r10k deployment is done!")
222
222
  reply_content = [result1[:stdout].join("\n"), result2[:stderr].join("\n")].join("\n")
223
- response.reply "/code " + sanitze_for_chat(reply_content)
223
+ response.reply as_code(reply_content)
224
224
  end
225
225
 
226
226
  Lita.register_handler(self)
data/lib/utils/text.rb CHANGED
@@ -11,5 +11,12 @@ module Utils
11
11
  # Remove bash colorings
12
12
  text.gsub(/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]/, '')
13
13
  end
14
+
15
+ # Format some text as code
16
+ # Note that this is HipChat specific for the moment
17
+ # TODO: Make this *not* HipChat specific
18
+ def as_code(text)
19
+ "/code " + sanitze_for_chat(text)
20
+ end
14
21
  end
15
22
  end
data/lita-puppet.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "lita-puppet"
3
- spec.version = "0.5.5"
4
- spec.authors = ["Jonathan Gnagy"]
3
+ spec.version = "0.6.0"
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"
7
7
  spec.summary = "Allow the Lita bot to handle requests for puppet tasks"
metadata CHANGED
@@ -1,9 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-puppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
+ - Daniel Schaaff
7
8
  - Jonathan Gnagy
8
9
  autorequire:
9
10
  bindir: bin
@@ -166,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
166
167
  version: '0'
167
168
  requirements: []
168
169
  rubyforge_project:
169
- rubygems_version: 2.4.8
170
+ rubygems_version: 2.5.1
170
171
  signing_key:
171
172
  specification_version: 4
172
173
  summary: Allow the Lita bot to handle requests for puppet tasks