[chef] Re: Re: Re: mode value for directory resource?


Chronological Thread 
  • From: "Mark J. Reed" < >
  • To:
  • Subject: [chef] Re: Re: Re: mode value for directory resource?
  • Date: Wed, 11 Aug 2010 18:40:06 -0400
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=Uhhbpdn3yT5wy9hl8CdJqBNCULmPppQe64btZxW5Hpe2dGHEpRe+SC+MB7ysJ2Jsmw a3hWtw2NPCCJMikWzSBRyggLSYttsKVxlY0I8z8O8vfSrhNqUMmGOnmN42vCUr96WCy0 pF+RfqgHuEOgw1IBvdvqDpHiX3Wkm0uK5s0xU=

Hm.  It's working on some hosts but not in others; I will have to
track it down.  They're all Ubuntu 10.04 32-bit running 0.9.8, so I'm
a bit perplexed.

Thanks for trying to reproduce it.

On Wed, Aug 11, 2010 at 5:19 PM, AJ Christensen 
< >
 wrote:
> On chef 0.9.8, using shef -s (standalone), I tested this quite briefly:
> Ohai2u 
> 
> chef > recipe
> chef:recipe > directory "/tmp/foo"
>  => #<Chef::Resource::Directory:0x101f90310 @not_if_args={},
> @cookbook_name=nil, @updated=false, @resource_name=:directory,
> @notifies_immediate=[], @before=nil,
> @run_context=#<Chef::RunContext:0x101fbda18
> @resource_collection=#<Chef::ResourceCollection:0x101fbd928
> @resources_by_name={"directory[/tmp/foo]"=>0},
> @resources=[#<Chef::Resource::Directory:0x101f90310 ...>],
> @insert_after_idx=nil>, @cookbook_collection={},
> @node=<Chef::Node:0x80fe04b8 @name="AJ-Christensens-MacBook-Pro.local">,
> @definitions={}>, @recursive=false, @not_if=nil, @action=:create,
> @name="/tmp/foo", @only_if_args={}, @allowed_actions=[:nothing, :create,
> :delete], @noop=nil, @ignore_failure=false, @node=<Chef::Node:0x80fe04b8
> @name="AJ-Christensens-MacBook-Pro.local">, @only_if=nil,
> @enclosing_provider=nil, @supports={}, @params={}, @path="/tmp/foo",
> @source_line="(irb#1):1:in `irb_binding'", @notifies_delayed=[],
> @provider=nil>
> chef:recipe > directory "/tmp/foo" do
> chef:recipe >     mode 00700
> chef:recipe ?>  end
>  => #<Chef::Resource::Directory:0x101f89df8 @mode=448, @not_if_args={},
> @cookbook_name=nil, @updated=false, @resource_name=:directory,
> @notifies_immediate=[], @before=nil,
> @run_context=#<Chef::RunContext:0x101fbda18
> @resource_collection=#<Chef::ResourceCollection:0x101fbd928
> @resources_by_name={"directory[/tmp/foo]"=>1},
> @resources=[#<Chef::Resource::Directory:0x101f90310 @not_if_args={},
> @cookbook_name=nil, @updated=false, @resource_name=:directory,
> @notifies_immediate=[], @before=nil,
> @run_context=#<Chef::RunContext:0x101fbda18 ...>, @recursive=false,
> @not_if=nil, @action=:create, @name="/tmp/foo", @only_if_args={},
> @allowed_actions=[:nothing, :create, :delete], @noop=nil,
> @ignore_failure=false, @node=<Chef::Node:0x80fe04b8
> @name="AJ-Christensens-MacBook-Pro.local">, @only_if=nil,
> @enclosing_provider=nil, @supports={}, @params={}, @path="/tmp/foo",
> @source_line="(irb#1):1:in `irb_binding'", @notifies_delayed=[],
> @provider=nil>, #<Chef::Resource::Directory:0x101f89df8 ...>],
> @insert_after_idx=nil>, @cookbook_collection={},
> @node=<Chef::Node:0x80fe04b8 @name="AJ-Christensens-MacBook-Pro.local">,
> @definitions={}>, @recursive=false, @not_if=nil, @action=:create,
> @name="/tmp/foo", @only_if_args={}, @allowed_actions=[:nothing, :create,
> :delete], @noop=nil, @ignore_failure=false, @node=<Chef::Node:0x80fe04b8
> @name="AJ-Christensens-MacBook-Pro.local">, @only_if=nil,
> @enclosing_provider=nil, @supports={}, @params={}, @path="/tmp/foo",
> @source_line="(irb#1):2:in `irb_binding'", @notifies_delayed=[],
> @provider=nil>
> chef:recipe > run_chef
> [Thu, 12 Aug 2010 09:19:08 +1200] DEBUG: Processing directory[/tmp/foo] on
> AJ-Christensens-MacBook-Pro.local
> [Thu, 12 Aug 2010 09:19:08 +1200] DEBUG: directory[/tmp/foo] using
> Chef::Provider::Directory
> [Thu, 12 Aug 2010 09:19:08 +1200] INFO: Creating directory[/tmp/foo] at
> /tmp/foo
> [Thu, 12 Aug 2010 09:19:08 +1200] DEBUG: Processing directory[/tmp/foo] on
> AJ-Christensens-MacBook-Pro.local
> [Thu, 12 Aug 2010 09:19:08 +1200] DEBUG: directory[/tmp/foo] using
> Chef::Provider::Directory
> [Thu, 12 Aug 2010 09:19:08 +1200] INFO: Setting mode to 700 for
> directory[/tmp/foo]
>  => true
> chef:recipe > `ls -la /tmp/foo`
>  => "total 0\ndrwx------   2 aj    wheel   68 12 Aug 09:19 .\ndrwxrwxrwt  14
> root  wheel  476 12 Aug 09:19 ..\n"
> Works for me :)
> On 12 August 2010 09:10, Mark J. Reed 
> < >
>  wrote:
>>
>> Oh, and I saw this on
>http://wiki.opscode.com/display/chef/Resources#Resources-Directory:
>>
>> >A note about mode: When specifying the mode, the value can be a quoted
>> > string, eg "644". For a >numeric value (i.e., without quotes), it should 
>> > be
>> > 5 digits, e.g., 00644 to ensure that Ruby can parse it >correctly. For 
>> > more
>> > detail, see Ticket CHEF-174.
>>
>> But neither the quotes nor the leading zero helped.
>>
>> On Wed, Aug 11, 2010 at 5:05 PM, Mark J. Reed 
>> < >
>>  wrote:
>> > OK, this is bombing on me:
>> >
>> > directory "/foo/bar" do
>> >    owner "username'
>> >    group "groupname"
>> >    mode 0700
>> > end
>> >
>> > I've tried all of
>> >
>> > mode "0700"
>> > mode 0700
>> > mode 700
>> > mode "700"
>> >
>> > And I always get this:
>> >
>> > ERROR: directory[/foo/bar]
>> > (/var/chef/cache/cookbooks/mycookbook/recipes/foo.rb:21:in
>> > `from_file') had an error:
>> > Option mode's value 44 does not match regular expression /^\d{3,4}$/
>> >
>> > So it looks like something's converting to decimal (0700 octal = 448
>> > decimal), stripping off the 8 because it's not a legal octal digit,
>> > and then complaining about the invalid mode.  Any help here?
>> >
>> > This is chef 0.9.8.
>> >
>> > --
>> > Mark J. Reed 
>> > < >
>> >
>>
>>
>>
>> --
>> Mark J. Reed 
>> < >
>
>



-- 
Mark J. Reed 
< >



Archive powered by MHonArc 2.6.16.

§