Skip to content

Commit

Permalink
Renames reserved resource name
Browse files Browse the repository at this point in the history
  • Loading branch information
spuder committed Mar 3, 2016
1 parent bd35f67 commit 9b2f2af
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ Allows easy management of IIS virtual directories (i.e. vdirs).

### Attribute Parameters

- `application_name`: name attribute. Specifies the name of the application attribute. This is the name of the website or application you are adding it to.
- `app_name`: name attribute. Specifies the name of the application attribute. This is the name of the website or application you are adding it to.
- `path`: The virtual directory path on the site.
- `physical_path`: The physical path of the virtual directory on the disk.
- `username`: (optional) The username required to logon to the physical_path. If set to "" will clear username and password.
Expand Down
20 changes: 10 additions & 10 deletions providers/vdir.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

action :add do
if !@current_resource.exists
cmd = "#{appcmd(node)} add vdir /app.name:\"#{new_resource.application_name}\""
cmd = "#{appcmd(node)} add vdir /app.name:\"#{new_resource.app_name}\""
cmd << " /path:\"#{new_resource.path}\""
cmd << " /physicalPath:\"#{windows_cleanpath(new_resource.physical_path)}\""
cmd << " /userName:\"#{new_resource.username}\"" if new_resource.username
Expand All @@ -40,7 +40,7 @@
Chef::Log.info(cmd)
shell_out!(cmd, returns: [0, 42, 183])
new_resource.updated_by_last_action(true)
Chef::Log.info("#{new_resource} added new virtual directory to application: '#{new_resource.application_name}'")
Chef::Log.info("#{new_resource} added new virtual directory to application: '#{new_resource.app_name}'")
else
Chef::Log.debug("#{new_resource} virtual directory already exists - nothing to do")
end
Expand Down Expand Up @@ -97,7 +97,7 @@

if @was_updated
new_resource.updated_by_last_action(true)
Chef::Log.info("#{new_resource} configured virtual directory to application: '#{new_resource.application_name}'")
Chef::Log.info("#{new_resource} configured virtual directory to application: '#{new_resource.app_name}'")
else
Chef::Log.debug("#{new_resource} virtual directory - nothing to do")
end
Expand All @@ -119,8 +119,8 @@
end

def load_current_resource
@current_resource = Chef::Resource::IisVdir.new(new_resource.name)
@current_resource.application_name(application_name_check)
@current_resource = Chef::Resource::IisVdir.new(new_resource.app_name)
@current_resource.app_name(application_name_check)
@current_resource.path(new_resource.path)
@current_resource.physical_path(new_resource.physical_path)
cmd = shell_out("#{appcmd(node)} list vdir \"#{application_identifier}\"")
Expand All @@ -141,13 +141,13 @@ def load_current_resource
private

def application_identifier
new_resource.application_name.chomp('/') + new_resource.path
new_resource.app_name.chomp('/') + new_resource.path
end

def application_name_check
if !new_resource.application_name.include?('/') && !new_resource.application_name.end_with?('/')
new_resource.application_name("#{new_resource.application_name}/")
elsif new_resource.application_name.chomp('/').include?('/') && new_resource.application_name.end_with?('/')
new_resource.application_name(new_resource.application_name.chomp('/'))
if !new_resource.app_name.include?('/') && !new_resource.app_name.end_with?('/')
new_resource.app_name("#{new_resource.app_name}/")
elsif new_resource.app_name.chomp('/').include?('/') && new_resource.app_name.end_with?('/')
new_resource.app_name(new_resource.app_name.chomp('/'))
end
end
2 changes: 1 addition & 1 deletion resources/vdir.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
actions :add, :delete, :config
default_action :add

attribute :application_name, kind_of: String, name_attribute: true
attribute :app_name, kind_of: String, name_attribute: true
attribute :path, kind_of: String
attribute :physical_path, kind_of: String
attribute :username, kind_of: String, default: nil
Expand Down

0 comments on commit 9b2f2af

Please sign in to comment.