Fwd: [Puppet Users] SSH authorized key module with support for multiple local accounts (Request for Feedback)

27 views
Skip to first unread message

Lukas Hetzenecker

unread,
Nov 12, 2012, 4:36:26 AM11/12/12
to puppe...@googlegroups.com
[FWD'ed to puppet-dev, question might be better for this list]

I developed a module that implements a better SSH key handling, but struggle with some Puppet basic for dealing with resources, see below:
 
Hello,

my module is now available from puppet forge too, thanks for your suggestion: http://forge.puppetlabs.com/hetzeneckerl/ssh_authorized_key

However, I'm still having one problem developing this module:

On *every* run I get some of these messages:

/Stage[main]/Ssh::Hetzeneckerl/Ssh[long_ssh_key]/Pxp_ssh_authorized_key_base[long_ssh_key]/user: defined 'type' as 'ssh-rsa'
/Stage[main]/Ssh::Hetzeneckerl/Ssh[long_ssh_key]/Pxp_ssh_authorized_key_base[long_ssh_key]/user: defined 'user' as 'root'

or when running with the noop flag: current_value absent, should be ssh-rsa (noop)
So basically the resource does not remember the previous records ("historical values") and/or does not know the actual current values.

These messages are generated by the apply_parameter method in resource_harness.rb where historical_value is set to nil, the full stacktrace is at the end of this message.

Could anybody have a look at the code uploaded to github and help me debugging this error and give me some clues how I can change the records returned by the fileparser?

Thanks for your help,
Lukas Hetzenecker

---- STACKTRACE ----

/usr/lib/ruby/site_ruby/1.8/puppet/transaction/resource_harness.rb:62:in `perform_changes'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction/resource_harness.rb:60:in `each'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction/resource_harness.rb:60:in `perform_changes'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction/resource_harness.rb:137:in `evaluate'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:49:in `apply'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:84:in `eval_resource'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:104:in `evaluate'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:348:in `thinmark'
/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:347:in `thinmark'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:104:in `evaluate'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:383:in `traverse'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:99:in `evaluate'
/usr/lib/ruby/site_ruby/1.8/puppet/resource/catalog.rb:144:in `apply'
/usr/lib/ruby/site_ruby/1.8/puppet/configurer.rb:122:in `apply_catalog'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:179:in `benchmark'
/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:178:in `benchmark'
/usr/lib/ruby/site_ruby/1.8/puppet/configurer.rb:121:in `apply_catalog'
/usr/lib/ruby/site_ruby/1.8/puppet/configurer.rb:179:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/application/apply.rb:265:in `apply_catalog'
/usr/lib/ruby/site_ruby/1.8/puppet/application/apply.rb:213:in `main'
/usr/lib/ruby/site_ruby/1.8/puppet/application/apply.rb:146:in `run_command'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:346:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:438:in `plugin_hook'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:346:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:500:in `exit_on_fail'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:346:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/util/command_line.rb:87:in `execute'
/usr/bin/puppet:4

On Wednesday, 7 November 2012 15:27:35 UTC+1, Lukas Hetzenecker wrote:
Hello,

my module is now available from puppet forge too, thanks for your suggestion: http://forge.puppetlabs.com/hetzeneckerl/ssh_authorized_key

However, I'm still having one problem developing this module:

On *every* run I get some of these messages:

/Stage[main]/Ssh::Hetzeneckerl/Ssh[long_ssh_key]/Pxp_ssh_authorized_key_base[long_ssh_key]/user: defined 'type' as 'ssh-rsa'
/Stage[main]/Ssh::Hetzeneckerl/Ssh[long_ssh_key]/Pxp_ssh_authorized_key_base[long_ssh_key]/user: defined 'user' as 'root'

or when running with the noop flag: current_value absent, should be ssh-rsa (noop)
So basically the resource does not remember the previous records ("historical values") and/or does not know the actual current values.

These messages are generated by the apply_parameter method in resource_harness.rb where historical_value is set to nil, the full stacktrace is at the end of this message.

Could anybody have a look at the code uploaded to github and help me debugging this error and give me some clues how I can change the records returned by the fileparser?

Thanks for your help,
Lukas Hetzenecker

---- STACKTRACE ----

/usr/lib/ruby/site_ruby/1.8/puppet/transaction/resource_harness.rb:62:in `perform_changes'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction/resource_harness.rb:60:in `each'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction/resource_harness.rb:60:in `perform_changes'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction/resource_harness.rb:137:in `evaluate'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:49:in `apply'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:84:in `eval_resource'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:104:in `evaluate'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:348:in `thinmark'
/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:347:in `thinmark'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:104:in `evaluate'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:383:in `traverse'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:99:in `evaluate'
/usr/lib/ruby/site_ruby/1.8/puppet/resource/catalog.rb:144:in `apply'
/usr/lib/ruby/site_ruby/1.8/puppet/configurer.rb:122:in `apply_catalog'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:179:in `benchmark'
/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:178:in `benchmark'
/usr/lib/ruby/site_ruby/1.8/puppet/configurer.rb:121:in `apply_catalog'
/usr/lib/ruby/site_ruby/1.8/puppet/configurer.rb:179:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/application/apply.rb:265:in `apply_catalog'
/usr/lib/ruby/site_ruby/1.8/puppet/application/apply.rb:213:in `main'
/usr/lib/ruby/site_ruby/1.8/puppet/application/apply.rb:146:in `run_command'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:346:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:438:in `plugin_hook'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:346:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:500:in `exit_on_fail'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:346:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/util/command_line.rb:87:in `execute'
/usr/bin/puppet:4

Lukas Hetzenecker

unread,
Nov 21, 2012, 4:58:23 AM11/21/12
to puppe...@googlegroups.com
I just read a few tutorials about developing modules, but I'm still not sure how to handle this case.
Would it be better if I use the "@should" approach instead of modifying the property directly?

Greetings,
Lukas
Reply all
Reply to author
Forward
0 new messages