lita-puppet 2.1.3 → 2.1.4

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: 6784e1f9c91bdbab4691357ae148e2fd90310001
4
- data.tar.gz: d879f631327cdee20d76c005fdea4c993261c3a5
3
+ metadata.gz: d80423ebb3746f0fda22ff43b2f93086bbc295ca
4
+ data.tar.gz: c8f55e2beeffe1cfe1e29d99d6c31d006894fa49
5
5
  SHA512:
6
- metadata.gz: 5cd85ed54bd6eebba840a5bc1baf530ef0ed12e73f21c065b34a01b111cef0e1e0346988f723b326e243f731309bc2e3f080c8eec63c6e11a3451ff27a4bd356
7
- data.tar.gz: c19266fc0db852119049a9287fd6a26337f110aaf99de06c3de910b715b0ac0d2703d2a2291f69bd68017cae93825ff4036eda1eaf2add7e001cc05c3e3ed31d
6
+ metadata.gz: 15fce99d528e4dfc3665481ddf0786debc70c52421a0b24bb00562bc58f446d32b12afb980543ca5277ee4df22c71770dd98700409db839ab696edb86f0cc42b
7
+ data.tar.gz: da28f2632ec6ebb15f61d8dba2981068193c24a67d707507e6aa6dba9a4226b0a9fa957ab5afe8ece0c2d638fb9cfbca07e0979bec95b7c6ac9a52df5ee82a85
@@ -35,13 +35,12 @@ module Utils
35
35
  output = begin
36
36
  # pass our host back to the user to work with
37
37
  Timeout.timeout(opts[:timeout]) { yield remote }
38
- rescue Rye::Err, StandardError => e
38
+ rescue Rye::Err, Timeout::Error => e
39
39
  exception = e
40
40
  ensure
41
41
  remote.disconnect
42
42
  end
43
43
 
44
- remote = nil # Try to force the destruction of the Rye box
45
44
  calculate_result(output, exception)
46
45
  end
47
46
 
@@ -35,7 +35,11 @@ module Utils
35
35
  # Strip off bad characters
36
36
  def sanitze_for_chat(text)
37
37
  # Remove bash colorings
38
- text.gsub(/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]/, '')
38
+ o = text.gsub(/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]/, '')
39
+ # Limit text to 50 lines
40
+ o = (o.lines.to_a[0...49] << "\n... truncated to 50 lines").join if o.lines.size > 50
41
+ # return the output
42
+ o
39
43
  end
40
44
  end
41
45
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'lita-puppet'
3
- spec.version = '2.1.3'
3
+ spec.version = '2.1.4'
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'
@@ -105,6 +105,10 @@ describe Lita::Handlers::Puppet, lita_handler: true do
105
105
  end
106
106
 
107
107
  describe('#puppet_agent_run') do
108
+ let(:rye_output_base) do
109
+ double(exit_status: 0, stdout: (0..99).to_a, stderr: ['bar'])
110
+ end
111
+
108
112
  before do
109
113
  robot.auth.add_user_to_group!(lita_user, :puppet_admins)
110
114
  end
@@ -113,6 +117,13 @@ describe Lita::Handlers::Puppet, lita_handler: true do
113
117
  send_command('puppet agent run on server.name', as: lita_user)
114
118
  expect(replies[-2]).to eq('that puppet run is complete! It exited with status 0.')
115
119
  end
120
+
121
+ it 'should truncate long results' do
122
+ allow(Rye::Box).to receive(:new).and_return(rye_box)
123
+ send_command('puppet agent run on server.name', as: lita_user)
124
+ expect(replies[-1].lines.last).to eq('... truncated to 50 lines')
125
+ expect(replies[-1].lines.size).to eq(51)
126
+ end
116
127
  end
117
128
 
118
129
  describe('#node_profiles') do
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.3
4
+ version: 2.1.4
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 00:00:00.000000000 Z
12
+ date: 2017-06-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: lita
@@ -225,7 +225,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
225
225
  version: '0'
226
226
  requirements: []
227
227
  rubyforge_project:
228
- rubygems_version: 2.4.5
228
+ rubygems_version: 2.6.12
229
229
  signing_key:
230
230
  specification_version: 4
231
231
  summary: Allow the Lita bot to handle requests for puppet tasks