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 +8 -8
- data/lib/dtk-node-agent/version.rb +1 -1
- data/mcollective_additions/plugins/v2.2/agent/execute_tests.rb +28 -21
- data/mcollective_additions/plugins/v2.2/agent/netstat.rb +2 -2
- data/mcollective_additions/plugins/v2.2/agent/puppet_apply.rb +15 -2
- data/mcollective_additions/plugins/v2.2/agent/ssh_agent.rb +1 -1
- metadata +10 -10
    
        checksums.yaml
    CHANGED
    
    | @@ -1,15 +1,15 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            !binary "U0hBMQ==":
         | 
| 3 3 | 
             
              metadata.gz: !binary |-
         | 
| 4 | 
            -
                 | 
| 4 | 
            +
                Yjk2YmU2OTNiNGIzNTUyZTFlNzc0NzY0OWY5ODdjMTIzODgxM2M2Ng==
         | 
| 5 5 | 
             
              data.tar.gz: !binary |-
         | 
| 6 | 
            -
                 | 
| 6 | 
            +
                ZGNhNmM3NzdhZjcwZTBjNGYyYzU0ZGRhYTgzYzViMzFiZjNkZDM1Nw==
         | 
| 7 7 | 
             
            SHA512:
         | 
| 8 8 | 
             
              metadata.gz: !binary |-
         | 
| 9 | 
            -
                 | 
| 10 | 
            -
                 | 
| 11 | 
            -
                 | 
| 9 | 
            +
                ODVkYjVjY2ZjNWI5ZGVlMDJlZWRjYTM4OWE1YzhhMGY3MTQxOWYzZjU2ZWEz
         | 
| 10 | 
            +
                ZTkwODg3OWMwMjA1ZTYxMjU0YmNjYTM4MDY2MWZjY2Y2NmQ2OGVkMjAwZjUz
         | 
| 11 | 
            +
                MmFjYzE1MzgyYzllYjdmODhmY2NjYmU4MjQyMWJmM2IzZTEwOTk=
         | 
| 12 12 | 
             
              data.tar.gz: !binary |-
         | 
| 13 | 
            -
                 | 
| 14 | 
            -
                 | 
| 15 | 
            -
                 | 
| 13 | 
            +
                NjA5MTIyNjQ3ZTllODdiMWVjOGYxYjdjMTdlNmRiZTkzM2MwMWQ3NGU1ZmVj
         | 
| 14 | 
            +
                YjY3YzA3YTJhMWRlZjZlZTc2NTcyZTc1Nzg1ZTEzZTFlZTY3MDRhNGViOWQ4
         | 
| 15 | 
            +
                ZTBmYmFmNDczODhkNzUyZWNjZDNiMDlhODZmZjk3ZDBhMTVmMDA=
         | 
| @@ -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 | 
            -
                     | 
| 77 | 
            -
                       | 
| 78 | 
            -
             | 
| 79 | 
            -
             | 
| 80 | 
            -
             | 
| 81 | 
            -
             | 
| 82 | 
            -
             | 
| 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 | 
            -
             | 
| 85 | 
            -
             | 
| 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 | 
            -
             | 
| 88 | 
            -
             | 
| 89 | 
            -
             | 
| 90 | 
            -
             | 
| 91 | 
            -
             | 
| 92 | 
            -
             | 
| 93 | 
            -
             | 
| 94 | 
            -
                         | 
| 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+([ | 
| 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  | 
| 200 | 
            -
                          ret[:errors] = (ret[:errors]||[]) + [{:message =>  | 
| 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
         | 
    
        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. | 
| 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- | 
| 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 | 
            -
            -  | 
| 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. | 
| 202 | 
            +
            rubygems_version: 2.2.2
         | 
| 203 203 | 
             
            signing_key: 
         | 
| 204 204 | 
             
            specification_version: 4
         | 
| 205 205 | 
             
            summary: DTK ndoe agent tool.
         |