-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Yes, the existing implementation of sym2oct does take the current mode (albeit using File instead of resource.stat) and makes the mode complete.
I didn't quite realize that sync didn't go through write. I see what you're saying and this will be easy enough to fix. Just having a bit of trouble getting my head around the total data flow. Thanks for the help. Trevor On 01/15/2010 06:25 PM, Luke Kanies wrote: > Hi Trevor, > > You'll need to modify the 'write' method on file to return the final > mode you want. That is, it currently expects the mode to be a complete > representation of what the mode should be, but you're instead returning > a symbol representation, and an incomplete one at that. > > I've already recommended you have a method that combines the mask you're > providing with the current mode to produce the final desired mode. > Modify the 'write' method to use that method instead of 'mode.should), > and you should be ok. > > On Jan 15, 2010, at 4:16 AM, Trevor Vaughan wrote: > >> And, one more reply to myself, but this time with a question! >> >> So, what's actually failing is the initial creation of a file that >> doesn't exist. >> >> It tries to grab mode.should and, of course, fails because it's not >> being pre-munged into something that Ruby understands. >> >> So, would it be acceptable to set the initial mode to 0600 and then >> let sync take care of it later or should I make yet another call to >> sym2oct for the conversion? >> >> Thanks, >> >> Trevor >> >> On Fri, Jan 15, 2010 at 5:56 AM, Trevor Vaughan >> <[email protected]> wrote: > In the interest of helping people who may be doing something like this > in the future.... > > I stepped through the code with ruby-debug and found that it is blowing > up validly in munge.pp:should_to_s which only expects to see an Integer > or a Symbol. > > When I allowed it to see a string, something else blew up. I'll see if > I can trace further on that later. > > The original code did base its decision on the existing mode of the file > but the following was communicated to me: > - munge should not expect to have all of its activity done on the > client system. > > - insync? and sync should be used to properly check against the > converted value and only sync should modify the result. > > Thanks, > > Trevor > > On 01/14/2010 09:29 PM, Trevor Vaughan wrote: >>>>> Ok, I started doing the suggested code changes, but didn't get very >>>>> far. >>>>> >>>>> When munge returns something other than an integer, something somewhere >>>>> blows up and I can't tell what or why. >>>>> >>>>> sync and insync? don't appear to be activated at all. >>>>> >>>>> The trace is attached from running the following: >>>>> >>>>> puppet --test --trace test.pp >>>>> >>>>> test.pp contains: >>>>> >>>>> file { "/tmp/foo": >>>>> ensure => 'file', >>>>> mode => 'o=u,o-w', >>>>> content => 'foo' >>>>> } >>>>> >>>>> The mode string is being returned by munge. >>>>> >>>>> Any clues would be appreciated. >>>>> >>>>> Also, I'm not going to try to refactor the munge method. It seems fine >>>>> to me (but that's probably why I'm not a full time Ruby programmer) so >>>>> I'm not really sure what you're looking for. >>>>> >>>>> Trevor >>>>> > <snip/> >>> >> >> >> >> -- >> Trevor Vaughan >> Vice President, Onyx Point, Inc >> (410) 541-6699 >> [email protected] >> >> -- This account not approved for unencrypted proprietary information -- >> -- >> You received this message because you are subscribed to the Google >> Groups "Puppet Developers" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/puppet-dev?hl=en. >> >> - -- Trevor Vaughan Vice President, Onyx Point, Inc. email: [email protected] phone: 410-541-ONYX (6699) - -- This account not approved for unencrypted sensitive information -- -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAktRzYwACgkQyWMIJmxwHpQp3QCfVZgXZ7g116LAdNlYMhc1+k/L OsMAnRUMMrpKCX5ED5xlm5d+2SUdmnxB =f5kl -----END PGP SIGNATURE-----
-- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.
