Skip to content
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 15 commits into from
May 17, 2017
Merged

Refactor vdir name property to site_name #359

merged 15 commits into from
May 17, 2017

Conversation

fdzedzy
Copy link

@fdzedzy fdzedzy commented May 15, 2017

Description

Refactoring the name property on the vdir resource to be site_name. This mimics the site_name property on the app resource. This will allow multiple vdirs to be created on a single site without creating a resource cloning error in Chef 13. Using a property called name will cause a property name collision.

This would create two virtual directories on the same site without throwing any Chef 13 warnings:

iis_vdir 'vdir1' do
  site_name 'Default Web Site/'
  path '/vdir_test1'
  physical_path "#{node['iis']['docroot']}\\vdir_test1"
  action [:add, :config]
end

iis_vdir 'vdir2' do
  site_name 'Default Web Site/'
  path '/vdir_test2'
  physical_path "#{node['iis']['docroot']}\\vdir_test2"
  action [:add, :config]
end

This change also creates consistency between the app and vdir resources.
Tests have been updated to match the app resource.

Check List

fdzedzy and others added 11 commits May 12, 2017 14:11
Signed-off-by: fdzedzy <fdzedzy@frontlinetechnologies.com>
Signed-off-by: fdzedzy <fdzedzy@frontlinetechnologies.com>
Signed-off-by: fdzedzy <fdzedzy@frontlinetechnologies.com>
Signed-off-by: Justin Schuhmann <jmschu02@gmail.com>
Signed-off-by: fdzedzy <fdzedzy@frontlinetechnologies.com>
Signed-off-by: fdzedzy <fdzedzy@frontlinetechnologies.com>
Signed-off-by: fdzedzy <fdzedzy@frontlinetechnologies.com>
Signed-off-by: fdzedzy <fdzedzy@frontlinetechnologies.com>
@EasyAsABC123
Copy link
Contributor

EasyAsABC123 commented May 15, 2017

this was changed from application_name to name because this is actually the

This is the name of the website or site + application you are adding it to.

Which isn't just the site name or the application name but a possible combination of both, technically this is referred to as the location or path. I went with name just to stop people from being confused

@EasyAsABC123
Copy link
Contributor

I agree this should change since there is a bug in chef 13 causing the before mentioned error, but i'd say we go with application_name since that's what it is called in appcmd

appcmd add vdir /app.name:contoso/marketing /path:/photos /physicalPath:c:\images

Copy link
Contributor

@EasyAsABC123 EasyAsABC123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mainly let's go with application_name since it matches the old name for it and the appcmd name for it.

README.md Outdated
@@ -397,7 +397,7 @@ Allows easy management of IIS virtual directories (i.e. vdirs).

#### Attribute Parameters

- `name`: name attribute. Specifies the value of the name attribute. This is the name of the website or site + application you are adding it to.
- `site_name`: name attribute. This is the name of the website or site + application you are adding it to.
Copy link
Contributor

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

@@ -29,9 +29,9 @@ class IisVdir < Inspec.resource(1)
end
"

def initialize(name, path)
@name = name
def initialize(path, site_name)
Copy link
Contributor

Choose a reason for hiding this comment

The 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

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I inverted them to be consistent with the app resource.

@fdzedzy
Copy link
Author

fdzedzy commented May 15, 2017

The problem I ran into with name is that it is also a ruby method. I picked site_name to match the attribute also used in the app resource. Virtual applications and virtual directories are both created under a site so they both seem similar in that regards.

@EasyAsABC123
Copy link
Contributor

Virtual directories go onto site and applications, that's the issue. I'm down with this change but it should be application_name since that is the same as appcmd

@fdzedzy
Copy link
Author

fdzedzy commented May 15, 2017

Ah, I see what you mean. That makes sense. I'll update that so it is more clear.

@EasyAsABC123
Copy link
Contributor

Awesome thanks! And good work catching this. Was this something that you could make fail in a test before your changes and work after?

fdzedzy added 4 commits May 16, 2017 07:52
Signed-off-by: fdzedzy <fdzedzy@frontlinetechnologies.com>
Signed-off-by: fdzedzy <fdzedzy@frontlinetechnologies.com>
Signed-off-by: fdzedzy <fdzedzy@frontlinetechnologies.com>
Signed-off-by: fdzedzy <fdzedzy@frontlinetechnologies.com>
@fdzedzy
Copy link
Author

fdzedzy commented May 16, 2017

I've got a cookbook that sets up a bunch of apps and virtual directories under a single site with a lot of unique configuration so there were several changes needed to use the new resources. In testing for Chef 13 compatibility I was resolving the duplicate resource issue and my cookbook wouldn't converge when I tried to set the name property because it said it was a Ruby method.

@EasyAsABC123
Copy link
Contributor

@fdzedzy that's weird...hurm, well renaming it should solve that. With the scripts you have can you add the failing items to the unit tests that already exists? basically add it to:
https://github.com/chef-cookbooks/iis/blob/master/test/integration/vdir/controls/vdir_spec.rb
https://github.com/chef-cookbooks/iis/blob/master/test/cookbooks/test/recipes/vdir.rb

@EasyAsABC123 EasyAsABC123 merged commit 75afae9 into sous-chefs:master May 17, 2017
@fdzedzy
Copy link
Author

fdzedzy commented May 17, 2017

@EasyAsABC123 Just to follow up, the test you added to cover the trailing slash PR should cover the scenario in this PR. I was thinking of adding another test to add a virtual directory to an application under a default site since this scenario wasn't covered. I can submit a new PR with that test. I'm wondering if that change to not require the / broke the scenario of adding a vdir to an app. Not sure if that is just my cookbook or a real issue yet.

kamaradclimber added a commit to criteo-forks/iis that referenced this pull request Jul 18, 2017
Most of the merge work is based on the fact that pool provider has been
replaced by a custom resource.

From all the non-merged criteo patches:
51e609a Fix decoding of entities in XML
5034448 Clarify execute tasks
43186f1 Activate use_inline_resources
99c4187 Remove unnecessary Chef logs
280fba8 Fix regression introduced with whyrun support
e85ca2f Fix the site_identifier privacy so that the execute context can use it
12ac82f Post review fixes
d534851 Removed new_resource.updated_by_last_action occurences
f9b773d Make the pool provider whyrun able

all are either unnecessary or correctly applied

* 'master' of https://github.com/chef-cookbooks/iis: (145 commits)
  Adds better documentation for the options parameter (sous-chefs#383)
  release 6.7.2 (sous-chefs#382)
  Fix FTP site binding error (sous-chefs#380)
  Release v6.7.1 (sous-chefs#379)
  Fix issue with guard clause missing on check (sous-chefs#378)
  Release v6.7.0 (sous-chefs#376)
  fix multiple bugs with iis_vdir iis_root iis_app for idempotency (sous-chefs#375)
  Release v6.6.0 (sous-chefs#373)
  Update appveyor.yml
  Enhancement module custom resource (sous-chefs#372)
  Fix README.md (sous-chefs#367)
  Release v6.5.3 (sous-chefs#371)
  Resolves a bug in iis_vdir also adds more liberty in config (sous-chefs#370)
  Refactor vdir name property to site_name (sous-chefs#359)
  Release v6.5.2 (sous-chefs#364)
  Update iis_vdir name to not require a trailing / (sous-chefs#363)
  Fix iis_pool identity_type issue (sous-chefs#362)
  Release v6.5.1 (sous-chefs#358)
  Add quotes to pool name (sous-chefs#357)
  Release v6.5.0 (sous-chefs#352)
  ...

Change-Id: I951fb2d1788d877c98b24bb22cb5d035162e146d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants