Skip to content

Instantly share code, notes, and snippets.

@schubert
Created August 24, 2012 05:09

Revisions

  1. schubert revised this gist Aug 24, 2012. 1 changed file with 2 additions and 3 deletions.
    5 changes: 2 additions & 3 deletions test.rb
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,3 @@

    directory node["application"]["path"] do
    not_if "test -d #{node['application']['path']}"
    action :create
    @@ -14,11 +13,11 @@
    end


    #INFO: Processing directory[/srv/apps] action create (jirafe-common::default line 33)
    #INFO: Processing directory[/srv/apps] action create (common::default line 33)
    #INFO: directory[/srv/apps] created directory /srv/apps
    #INFO: directory[/srv/apps] owner changed to 1000
    #INFO: directory[/srv/apps] group changed to 4
    #INFO: directory[/srv/apps] mode changed to 775
    #DEBUG: Processing directory[/srv/apps] on testing
    #INFO: Processing directory[/srv/apps] action delete (jirafe-common::default line 42)
    #INFO: Processing directory[/srv/apps] action delete (common::default line 42)
    #DEBUG: Skipping directory[/srv/apps] due to not_if command `test -d /srv/apps`
  2. schubert created this gist Aug 24, 2012.
    24 changes: 24 additions & 0 deletions test.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@

    directory node["application"]["path"] do
    not_if "test -d #{node['application']['path']}"
    action :create
    recursive true
    owner node["environment"]["user"]
    group node["environment"]["group"]
    mode "775"
    end

    directory node["application"]["path"] do
    not_if "test -L #{node['application']['path']}"
    action :delete
    end


    #INFO: Processing directory[/srv/apps] action create (jirafe-common::default line 33)
    #INFO: directory[/srv/apps] created directory /srv/apps
    #INFO: directory[/srv/apps] owner changed to 1000
    #INFO: directory[/srv/apps] group changed to 4
    #INFO: directory[/srv/apps] mode changed to 775
    #DEBUG: Processing directory[/srv/apps] on testing
    #INFO: Processing directory[/srv/apps] action delete (jirafe-common::default line 42)
    #DEBUG: Skipping directory[/srv/apps] due to not_if command `test -d /srv/apps`