-
-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor vdir name property to site_name #359
Merged
Merged
Changes from 4 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
08974a4
Fixing pool name spaces bug
b7b4975
setting pool test to have space in name
8b57872
merging in master
91b2f81
Fix tests for iis_pool
EasyAsABC123 96e7824
Merge pull request #1 from EasyAsABC123/master
4e90162
Refactor vdir name to site_name
4402205
Merge branch 'master' of https://github.com/fdzedzy/iis
08164b4
Update to tests
64d54cf
Merge branch 'master' of https://github.com/chef-cookbooks/iis
f22d8d4
Cleaning up testing code
86252b3
Fixing unit tests
5dea201
changing site_name to application_name
0a3e724
Resolving merge conflicts
c019cc5
Fixing unit test
70674d8
Switching order of properties in spec to pass unit tests
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,9 +29,9 @@ class IisVdir < Inspec.resource(1) | |
end | ||
" | ||
|
||
def initialize(name, path) | ||
@name = name | ||
def initialize(path, site_name) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no reason to invert these, just leave them as is...also change to application name if desired although no required There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I inverted them to be consistent with the |
||
@path = path | ||
@site_name = site_name | ||
@cache = nil | ||
|
||
@vdir_provider = VdirProvider.new(inspec) | ||
|
@@ -40,6 +40,10 @@ def initialize(name, path) | |
skip_resource 'The `iis_vdir` resource is not supported on your OS.' unless inspec.os.windows? | ||
end | ||
|
||
def site_name | ||
iis_vdir[:site_name] | ||
end | ||
|
||
def path | ||
iis_vdir[:path] | ||
end | ||
|
@@ -68,6 +72,10 @@ def exists? | |
!iis_vdir[:path].empty? | ||
end | ||
|
||
def has_site_name?(site_name) | ||
iis_vdir[:site_name] == site_name | ||
end | ||
|
||
def has_path?(path) | ||
iis_vdir[:path] == path | ||
end | ||
|
@@ -93,12 +101,12 @@ def has_allow_sub_dir_config?(allow) | |
end | ||
|
||
def to_s | ||
"iis_vdir '#{@name}#{@path}'" | ||
"iis_vdir '#{@site_name}#{@path}'" | ||
end | ||
|
||
def iis_vdir | ||
return @cache unless @cache.nil? | ||
@cache = @vdir_provider.iis_vdir(@name, @path) unless @vdir_provider.nil? | ||
@cache = @vdir_provider.iis_vdir(@site_name, @path) unless @vdir_provider.nil? | ||
end | ||
end | ||
|
||
|
@@ -110,8 +118,8 @@ def initialize(inspec) | |
end | ||
|
||
# want to populate everything using one powershell command here and spit it out as json | ||
def iis_vdir(name, path) | ||
command = "Import-Module WebAdministration; Get-WebVirtualDirectory -Site \"#{name}\" -Name \"#{path}\" | Select-Object path, physicalPath, userName, password, logonMethod, allowSubDirConfig, PSPath, ItemXPath | ConvertTo-Json" | ||
def iis_vdir(path, site_name) | ||
command = "Import-Module WebAdministration; Get-WebVirtualDirectory -Site \"#{site_name}\" -Name \"#{path}\" | Select-Object path, physicalPath, userName, password, logonMethod, allowSubDirConfig, PSPath, ItemXPath | ConvertTo-Json" | ||
cmd = @inspec.command(command) | ||
|
||
begin | ||
|
@@ -123,6 +131,7 @@ def iis_vdir(name, path) | |
|
||
# map our values to a hash table | ||
{ | ||
site_name: site_name, | ||
path: vdir['path'], | ||
physical_path: vdir['physicalPath'], | ||
username: vdir['userName'], | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's use
application_name
this will add backwards compatibility back and not make this more confusing since app.name is the property used in appcmd