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:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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.
 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)

iEYEARECAAYFAktQSdoACgkQyWMIJmxwHpS3yQCdE1p6lz/BYUmMzoswFMwdR/WD
HkkAoJbWMQz+3XOazw+gDDS4Y+dRaJID
=rtIU
-----END PGP SIGNATURE-----




--
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 .




--
It's very hard to predict things . . . Especially the future.
    -- Prof. Charles Kelemen, Swarthmore CS Dept.
---------------------------------------------------------------------
Luke Kanies  -|-   http://reductivelabs.com   -|-   +1(615)594-8199

-- 
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.


Reply via email to