Skip to content

Instantly share code, notes, and snippets.

@vinyar
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vinyar/8c84d85ad989e30db7ce to your computer and use it in GitHub Desktop.
Save vinyar/8c84d85ad989e30db7ce to your computer and use it in GitHub Desktop.
attribute:
default['ge_opsware_agent']['agent_dir'] = "/opt/opsware/stage/agent"
recipe:
directory node['ge_opsware_agent']['agent_dir'] do
owner "root"
group "root"
mode 0755
action :create
recursive true
end
resulting resource:
directory[/opt/opsware/stage/agent] @name: "/opt/opsware/stage/agent" @noop: nil @before: nil @params: {} @
provider: Chef::Provider::Directory @allowed_actions: [:nothing, :create, :delete] @action: [:create]
@updated: false @updated_by_last_action: false @supports: {} @ignore_failure: false @retries: 0 @r
etry_delay: 2 @source_line: "(irb#2):1:in `irb_binding'" @guard_interpreter: :default @elapsed_time: 0
@resource_name: :directory @path: "/opt/opsware/stage/agent" @recursive: true @cookbook_name: nil @recipe_name: nil @
owner: "root" @group: "root" @mode: 493>
Unit test:
it 'create directory' do
expect(chef_run).to create_directory('/opt/opsware/stage/agent').with_owner('root').with_group('root').with_mode('0755')
end
failure:
mode "0755", was 493
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment