dtk-node-agent 0.5.12 → 0.5.13

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NGUwMWQxZTY3ZDA1MWUyOGNkNDI3YWUxZWYxNjhkYzUwY2JlZTBkMA==
4
+ Yjk2YmU2OTNiNGIzNTUyZTFlNzc0NzY0OWY5ODdjMTIzODgxM2M2Ng==
5
5
  data.tar.gz: !binary |-
6
- ODc0NTA0ZDRkMzQxZmI1ODkyNTIyNDliOWRiZGM3OTRjMjcwM2Q0Yw==
6
+ ZGNhNmM3NzdhZjcwZTBjNGYyYzU0ZGRhYTgzYzViMzFiZjNkZDM1Nw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MDIxZWIzNmEzYzNmNTk1N2U5ZjcyNDkyNDhjMDExNTYwMmFhNzhiODk0YmVm
10
- YTkzZGRjZDJiZDg5MmVhOWE1NGU2MGQ4YjMwMGY4YjQ0YzIzMDNiMTA3MWJh
11
- Yzc3NGIwYjdiMzU4M2Q4NDNjNzI5YTg4YzM0YWI2NGY0N2VlODE=
9
+ ODVkYjVjY2ZjNWI5ZGVlMDJlZWRjYTM4OWE1YzhhMGY3MTQxOWYzZjU2ZWEz
10
+ ZTkwODg3OWMwMjA1ZTYxMjU0YmNjYTM4MDY2MWZjY2Y2NmQ2OGVkMjAwZjUz
11
+ MmFjYzE1MzgyYzllYjdmODhmY2NjYmU4MjQyMWJmM2IzZTEwOTk=
12
12
  data.tar.gz: !binary |-
13
- OGViMTNmMTc3ODkzYmQ0YzA5YzYwODNhMjYzOTViMDA2YmRkNzZjYmI4YzZk
14
- YTkxMzJjODYxNTRhYmQwYzZhMGEwNjAxMzk0NTI0NzQyYjRkODFiMTQ5NGJi
15
- MzAwNjFkMTFiYjgyZjc5M2QyNTgxMmRmYzdhOGU5Njg3NDA4ODY=
13
+ NjA5MTIyNjQ3ZTllODdiMWVjOGYxYjdjMTdlNmRiZTkzM2MwMWQ3NGU1ZmVj
14
+ YjY3YzA3YTJhMWRlZjZlZTc2NTcyZTc1Nzg1ZTEzZTFlZTY3MDRhNGViOWQ4
15
+ ZTBmYmFmNDczODhkNzUyZWNjZDNiMDlhODZmZjk3ZDBhMTVmMDA=
@@ -1,3 +1,3 @@
1
1
  module DtkNodeAgent
2
- VERSION="0.5.12"
2
+ VERSION="0.5.13"
3
3
  end
@@ -73,31 +73,38 @@ module MCollective
73
73
  #Pull latest changes for modules if any
74
74
  git_server = Facts["git-server"]
75
75
 
76
- modules_info.each do |module_info|
77
- component_module = module_info[:module_name]
78
- component_name = module_info[:component_name]
79
- full_component_name = module_info[:full_component_name]
80
- #Filter out version context for modules that don't exist on node
81
- filtered_version_context = request[:version_context].select { |x| x[:implementation] == module_info[:module_name] }.first
82
- pull_modules(filtered_version_context,git_server)
76
+ begin
77
+ modules_info.each do |module_info|
78
+ component_module = module_info[:module_name]
79
+ component_name = module_info[:component_name]
80
+ full_component_name = module_info[:full_component_name]
81
+ #Filter out version context for modules that don't exist on node
82
+ filtered_version_context = request[:version_context].select { |x| x[:implementation] == module_info[:module_name] }.first
83
+ pull_modules(filtered_version_context,git_server)
83
84
 
84
- spec_results=`/opt/puppet-omnibus/embedded/bin/rspec /etc/puppet/modules/#{component_module}/dtk/serverspec/spec/localhost/#{component_name}/*_spec.rb --format j`
85
- @log.info("Executing serverspec test: /etc/puppet/modules/#{component_module}/dtk/serverspec/spec/localhost/#{component_name}/*_spec.rb")
85
+ @log.info("Executing serverspec test: /etc/puppet/modules/#{component_module}/dtk/serverspec/spec/localhost/#{component_name}/*_spec.rb")
86
+ spec_results=`/opt/puppet-omnibus/embedded/bin/rspec /etc/puppet/modules/#{component_module}/dtk/serverspec/spec/localhost/#{component_name}/*_spec.rb --format j 2>&1`
87
+ raise spec_results unless spec_results_json = JSON.parse(spec_results)
86
88
 
87
- spec_results_json = JSON.parse(spec_results)
88
- spec_results_json['examples'].each do |spec|
89
- spec_result = {}
90
- spec_result.store(:module_name, component_module)
91
- spec_result.store(:component_name, full_component_name)
92
- spec_result.store(:test_result, spec['full_description'])
93
- spec_result.store(:status, spec['status'])
94
- all_spec_results << spec_result
89
+ spec_results_json['examples'].each do |spec|
90
+ spec_result = {}
91
+ spec_result.store(:module_name, component_module)
92
+ spec_result.store(:component_name, full_component_name)
93
+ spec_result.store(:test_result, spec['full_description'])
94
+ spec_result.store(:status, spec['status'])
95
+ all_spec_results << spec_result
96
+ end
95
97
  end
98
+ reply[:data] = all_spec_results
99
+ reply[:pbuilderid] = Facts["pbuilderid"]
100
+ reply[:status] = :ok
101
+ rescue Exception => e
102
+ @log.info("Error while executing serverspec test")
103
+ @log.info(e.message)
104
+ reply[:data] = { :test_error => "#{e.message.lines.first}" }
105
+ reply[:pbuilderid] = Facts["pbuilderid"]
106
+ reply[:status] = :notok
96
107
  end
97
-
98
- reply[:data] = all_spec_results
99
- reply[:pbuilderid] = Facts["pbuilderid"]
100
- reply[:status] = :ok
101
108
  end
102
109
  end
103
110
  end
@@ -10,8 +10,8 @@ module MCollective
10
10
  :timeout => 2
11
11
  action "get_tcp_udp" do
12
12
  output = `netstat -nltpu`
13
- results = output.scan(/(^[a-z0-9]+)\s+(\d)\s+(\d)\s+([0-9:.*]+)\s+([0-9:.*]+)\s+(LISTEN)?\s+([0-9a-zA-Z\/\-: ]+)/m)
14
-
13
+ results = output.scan(/(^[a-z0-9]+)\s+(\d)\s+(\d)\s+([a-z0-9:.*]+)\s+([0-9:.*]+)\s+(LISTEN)?\s+([0-9a-zA-Z\/\-: ]+)/m)
14
+
15
15
  netstat_result = []
16
16
  results.each do |result|
17
17
  netstat_packet = {}
@@ -196,8 +196,8 @@ module MCollective
196
196
  stderr_msg = stderr_capture.read
197
197
  stderr_capture.close
198
198
  stderr_capture.unlink
199
- if stderr_msg and not stderr_msg.empty?
200
- ret[:errors] = (ret[:errors]||[]) + [{:message => stderr_msg, :type => "user_error" }]
199
+ if err_message = compile_error_message?(return_code,stderr_msg,log_file_path)
200
+ ret[:errors] = (ret[:errors]||[]) + [{:message => err_message, :type => "user_error" }]
201
201
  ret.set_status_failed!()
202
202
  Puppet::err stderr_msg
203
203
  Puppet::info "(end)"
@@ -208,6 +208,19 @@ module MCollective
208
208
  ret
209
209
  end
210
210
 
211
+ def compile_error_message?(return_code,stderr_msg,log_file_path)
212
+ if stderr_msg and not stderr_msg.empty?
213
+ stderr_msg
214
+ elsif return_code != 0
215
+ if last_line = File.open(log_file_path).lines.map{|l|l}.last
216
+ #TODO: might be more general pattern to search
217
+ if last_line =~ /^.+Puppet \(err\):\s*(.+$)/
218
+ $1
219
+ end
220
+ end
221
+ end
222
+ end
223
+
211
224
  def backtrace_subset(e)
212
225
  e.backtrace[0..10]
213
226
  end
@@ -75,7 +75,7 @@ module MCollective
75
75
  end
76
76
 
77
77
  def does_user_exist?(system_user)
78
- !File.open('/etc/passwd').grep(/home\/#{system_user}:/).empty?
78
+ !File.open('/etc/passwd').grep(/^#{system_user}:/).empty?
79
79
  end
80
80
 
81
81
  def key_added?(system_user, pub_key)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dtk-node-agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.12
4
+ version: 0.5.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rich PELAVIN
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-08 00:00:00.000000000 Z
11
+ date: 2014-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: puppet
@@ -116,19 +116,14 @@ executables:
116
116
  extensions: []
117
117
  extra_rdoc_files: []
118
118
  files:
119
- - README.md
120
119
  - Gemfile
121
120
  - Gemfile.lock
122
- - dtk-node-agent.gemspec
121
+ - README.md
123
122
  - bin/dtk-node-agent
123
+ - dtk-node-agent.gemspec
124
124
  - lib/config/install.config
125
125
  - lib/dtk-node-agent/installer.rb
126
126
  - lib/dtk-node-agent/version.rb
127
- - puppet_additions/modules/r8/lib/puppet/type/r8_export_file.rb
128
- - puppet_additions/modules/r8/manifests/export_variable.rb
129
- - puppet_additions/puppet_lib_base/puppet/indirector/catalog/r8_storeconfig_backend.rb
130
- - puppet_additions/puppet_lib_base/puppet/indirector/r8_storeconfig_backend.rb
131
- - puppet_additions/puppet_lib_base/puppet/indirector/resource/r8_storeconfig_backend.rb
132
127
  - mcollective_additions/plugins/README.md
133
128
  - mcollective_additions/plugins/v1.2/agent/discovery.rb
134
129
  - mcollective_additions/plugins/v1.2/agent/get_log_fragment.ddl
@@ -176,6 +171,11 @@ files:
176
171
  - mcollective_additions/plugins/v2.2/security/sshkey.rb
177
172
  - mcollective_additions/plugins/v2.2/util/puppetrunner.rb
178
173
  - mcollective_additions/server.cfg
174
+ - puppet_additions/modules/r8/lib/puppet/type/r8_export_file.rb
175
+ - puppet_additions/modules/r8/manifests/export_variable.rb
176
+ - puppet_additions/puppet_lib_base/puppet/indirector/catalog/r8_storeconfig_backend.rb
177
+ - puppet_additions/puppet_lib_base/puppet/indirector/r8_storeconfig_backend.rb
178
+ - puppet_additions/puppet_lib_base/puppet/indirector/resource/r8_storeconfig_backend.rb
179
179
  - src/etc/init.d/ec2-run-user-data
180
180
  - src/etc/logrotate.d/mcollective
181
181
  - src/etc/logrotate.d/puppet
@@ -199,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
199
199
  version: '0'
200
200
  requirements: []
201
201
  rubyforge_project:
202
- rubygems_version: 2.1.9
202
+ rubygems_version: 2.2.2
203
203
  signing_key:
204
204
  specification_version: 4
205
205
  summary: DTK ndoe agent tool.