Setting validproperties fields in provider modules

38 views
Skip to first unread message

HPUX_PUPPET

unread,
Feb 19, 2014, 9:29:37 PM2/19/14
to puppet...@googlegroups.com
I am still working to the HPUX provider to handle password expirations and I have gotten the max and min password age values extracted from the OS, but for the life of me I cannot seem to get them to assign to the :password_max_age and :password_min_age fields in the Ruby code.

I know from looking at other modules that I can get the values from doing a loop on @resource.class.validproperties and set the value by doing value = @resource.should(<loop var>). 

I am still learning Ruby and I thought I had it down enough to handle assigning to this variable yet I am still missing something here. 

Can anyone provide me some guidance as to why I just cannot get this to assign and propagate back up the super class?

Thanks!

Felix Frank

unread,
Apr 14, 2014, 11:51:52 AM4/14/14
to puppet...@googlegroups.com
Hi,

sorry for the late reply.

Did you ever get this fixed?

Cheers,
Felix

Jim Perry

unread,
Apr 14, 2014, 11:53:04 AM4/14/14
to puppet...@googlegroups.com

Not so far. You are the first reply.

--
You received this message because you are subscribed to a topic in the Google Groups "Puppet Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/puppet-users/66hM1Vc8fYU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/534C0418.8060807%40alumni.tu-berlin.de.
For more options, visit https://groups.google.com/d/optout.

Felix Frank

unread,
Apr 14, 2014, 11:59:37 AM4/14/14
to puppet...@googlegroups.com
Okay then.

Is your code up on github or pastebin for direct review?

Jim Perry

unread,
Apr 14, 2014, 12:37:14 PM4/14/14
to puppet...@googlegroups.com

Not yet. I don't have it working and I was asking how to get our data for troubleshooting it first.

--
You received this message because you are subscribed to a topic in the Google Groups "Puppet Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/puppet-users/66hM1Vc8fYU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to puppet-users...@googlegroups.com.

Felix Frank

unread,
Apr 15, 2014, 7:16:03 AM4/15/14
to puppet...@googlegroups.com
On 04/14/2014 06:37 PM, Jim Perry wrote:
> Not yet. I don't have it working and I was asking how to get our data
> for troubleshooting it first.

I see, well, this is unfortunate - debugging this (or even comparing it
to working code) will be nigh impossible without looking at your
concrete status.

I'd like to ask you to rethink at least sharing an anonymized version on
a paste service or gist.

Thanks in advance,
Felix

James Perry

unread,
Apr 15, 2014, 9:11:25 PM4/15/14
to puppet...@googlegroups.com
The HPUX code I am trying to modify is already in the existing Puppet
code base at
https://github.com/puppetlabs/puppet/blob/master/lib/puppet/provider/user/hpux.rb.


The functionality I am trying to use is to set the value of a specific
property so that I can specify the commands to run depending on which
password aging scheme is required on a specific HPUX OS version and
setup. Some are trusted computing, some use a version of the shadow
password and others just a plain old password file.

The module I found the functionality I want to extend is based on the
snippet of code starting at line 11 of
https://github.com/adrienthebo/puppet-filemapper/blob/master/lib/puppetx/filemapper.rb.

Unfortunately I am unable to seem to get it to work and thus I am at a
loss. I really need to be able to ensure that the proper expiry setups
are in place for HPUX because while I managed to get the password
functionality into the main stream code base, it is not likewise
resetting the password expiration for another 90 days and thus the
account gets locked out.

Felix Frank

unread,
Apr 16, 2014, 4:02:04 AM4/16/14
to puppet...@googlegroups.com
Hmm, I still don't really see what you are intent on doing specifically,
to be honest.

Looking at
https://github.com/puppetlabs/puppet/blob/master/lib/puppet/provider/user/useradd.rb#L195
does this problem not boil down to overriding the passcmd method and
adding some kind of case statements to handle your different environments?

You mentioned at the beginning of the thread that you're facing issues
accessing the resource property values. These *should* work:

min_age = resource.should(:password_min_age)
max_age = resource.should(:password_max_age)

If I'm not mistaken, this should be synonymous with e.g.
resource[:password_min_age]. `resource` is the attr_accessor for
`@resource`. I'm not sure why so much provider code ignores the accessors.

Felix

Jim Perry

unread,
Apr 16, 2014, 12:10:05 PM4/16/14
to puppet...@googlegroups.com

Thanks. I am still learning Ruby so I will look into accessors in more detail.

What I am trying to do is call the HPUX provider and use it to set the min and max age that gets passed back to the parent. Then I also need to be able to verify the right commands are used to reset the expiration when the user password is updated if it is a trusted setup.

> --
> You received this message because you are subscribed to a topic in the Google Groups "Puppet Users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/puppet-users/66hM1Vc8fYU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to puppet-users...@googlegroups.com.

> To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/534E38FC.7090405%40alumni.tu-berlin.de.

Felix Frank

unread,
Apr 17, 2014, 4:38:01 PM4/17/14
to puppet...@googlegroups.com
Hi,

On 04/16/2014 06:10 PM, Jim Perry wrote:
> Thanks. I am still learning Ruby so I will look into accessors in more
> detail.

Sure, but note that those aren't the important point. Sticking to
@resource should work just as well.

> What I am trying to do is call the HPUX provider and use it to set the
> min and max age that gets passed back to the parent. Then I also need to
> be able to verify the right commands are used to reset the expiration
> when the user password is updated if it is a trusted setup.

Hmm, that sounds as though there was some kind of basic problem in your
approach. The agent does not explicitly send messages to single
providers. Instead, ou would expect the agent to select the HPUX
provider on its own and see to it that the necessary overrides are in place.

I realize that I probably read like the metaphorical broken record, but
if you could share at least some pseudo code that depicts what you are
currently trying, we could discuss in a much more effective fashion.
We're about two layers too meta :)

Thanks,
Felix
Reply all
Reply to author
Forward
0 new messages