Opened 6 years ago

Closed 6 years ago

#213 closed change (fixed)

Make sure kick.py can still parse Puppet files with newer Puppet releases

Reported by: trev Assignee: trev
Priority: P4 Milestone:
Module: Infrastructure Keywords:
Cc: Blocked By:
Blocking: Platform:
Ready: yes Confidential: no
Tester: Verified working: no
Review URL(s):

http://codereview.adblockplus.org/5653767139622912

Description

Background

We are using the kick.py script we are using to push updates to the servers. That script parses manifests/monitoringserver.pp file in order to validate host names and groups. For that it uses Puppet's parser. However, it was written for an older version of Puppet and no longer works with the current versions, producing the following exception:

/Library/Ruby/Gems/2.0.0/gems/puppet-3.4.2/lib/puppet/parser.rb:2:in `<top (required)>': uninitialized constant Puppet (NameError)

from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:110:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:110:in `rescue in require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:35:in `require'
from -:2:in `<main>'

Adding require puppet to the Ruby code we are running here changes the exception to the following:

/Library/Ruby/Gems/2.0.0/gems/puppet-3.4.2/lib/puppet/settings.rb:315:in `block in convert': Could not parse for environment production: Error converting value for param 'manifest': Error converting value for param 'manifestdir': Could not find value for $confdir (Puppet::Error)

from /Library/Ruby/Gems/2.0.0/gems/puppet-3.4.2/lib/puppet/settings.rb:306:in `gsub'
from /Library/Ruby/Gems/2.0.0/gems/puppet-3.4.2/lib/puppet/settings.rb:306:in `convert'
from /Library/Ruby/Gems/2.0.0/gems/puppet-3.4.2/lib/puppet/settings.rb:1020:in `value'
from /Library/Ruby/Gems/2.0.0/gems/puppet-3.4.2/lib/puppet/settings.rb:312:in `block in convert'
from /Library/Ruby/Gems/2.0.0/gems/puppet-3.4.2/lib/puppet/settings.rb:306:in `gsub'
from /Library/Ruby/Gems/2.0.0/gems/puppet-3.4.2/lib/puppet/settings.rb:306:in `convert'
from /Library/Ruby/Gems/2.0.0/gems/puppet-3.4.2/lib/puppet/settings.rb:1020:in `value'
from /Library/Ruby/Gems/2.0.0/gems/puppet-3.4.2/lib/puppet/node/environment.rb:463:in `perform_initial_import'
from /Library/Ruby/Gems/2.0.0/gems/puppet-3.4.2/lib/puppet/node/environment.rb:216:in `known_resource_types'
from /Library/Ruby/Gems/2.0.0/gems/puppet-3.4.2/lib/puppet/resource/type_collection_helper.rb:5:in `known_resource_types'
from /Library/Ruby/Gems/2.0.0/gems/puppet-3.4.2/lib/puppet/parser/parser_support.rb:90:in `file='
from -:5:in `<main>'

What to change

Update the Ruby code executed from kick.py to support current Puppet versions.

Change History (3)

comment:1 Changed 6 years ago by trev

  • Owner set to trev
  • Status changed from new to assigned

comment:2 Changed 6 years ago by trev

  • in_progress changed from 0 to 1
  • Review URL(s) modified (diff)
  • Status changed from assigned to reviewing

comment:3 Changed 6 years ago by trev

  • in_progress changed from 1 to 0
  • Resolution set to fixed
  • Status changed from reviewing to closed
Note: See TracTickets for help on using tickets.