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

WebApplication: Physical path overwritten after desired state applied #587

Open
spriet2000 opened this issue Nov 11, 2020 · 7 comments
Open
Labels
enhancement The issue is an enhancement request. help wanted The issue is up for grabs for anyone in the community.

Comments

@spriet2000
Copy link

Hello,

I am setting up a webserver with some applications using dsc and the first run works. All apps and settings are correct setup. The physical path is pointing to a default directory.

The physical path is pointing to a default directory, because an automated deployment process runs after the initial dsc run and sets the correct physical path.

The automated deployment process will set the physical path to a new folder after each deployment. Deployments are organised by another team.

The problem for me starts when I want to run the dsc script again to update something on the node. All the physical paths are set back to default directory which breaks the application.

How can this behavior be prevented? Could you give me some advice?

@johlju
Copy link
Member

johlju commented Nov 12, 2020

You should not have the PhysicalPath as part of the configuration if you do not want to enforce that property.

@johlju johlju added the waiting for author response The pull request is waiting for the author to respond to comments in the pull request. label Nov 12, 2020
@spriet2000
Copy link
Author

spriet2000 commented Nov 16, 2020

Thanks for your reply. I have tried that option and it seems that physical path for xWebApplication is a required property.

@spriet2000
Copy link
Author

If its a good idea to make physical path optional, I could spend some time on it and try to create a pull request.
But why is it optional for a website and not for an application? Does it have a good reason? Tried before?

@renebrandnewday
Copy link

Is there any news here?

@johlju
Copy link
Member

johlju commented Jan 13, 2023

The parameter PhysicalPath could be made optional. Then logic need to be added that verifies that it is set when a web application should be created as it probably a necessary value for creation (?), but is should not be a mandatory parameter if there is an existing web application where one do not want to enforce the property PhysicalPath.

Community need to update logic in resource, update unit test and creat necessary integration tests. 🙂 Happy to review a PR.

@johlju johlju added enhancement The issue is an enhancement request. help wanted The issue is up for grabs for anyone in the community. and removed waiting for author response The pull request is waiting for the author to respond to comments in the pull request. labels Jan 13, 2023
@johlju johlju changed the title Physical path overwritten after desired state applied WebApplication: Physical path overwritten after desired state applied Jan 13, 2023
@renebrandnewday
Copy link

renebrandnewday commented Jan 16, 2023

Thanks for answering. I could get some pointers before actually building this.

When creating a website/app, its required. When updating for example the app pool it is not.
Are there other DSC examples which work like this and could be used as an example?

Alternative:

A property could be added to the Website/WebApplication to set the behavior. For example: SetPhysicalPath = $false.

My current solution is to retrieve all the physical paths first from a target node and write them in the DSC file before executing:
It's too complicated, error prone and difficult to explain to my co-workers.

Are there preferences how to do this?

@johlju
Copy link
Member

johlju commented Jan 16, 2023

Are there other DSC examples which work like this...

The normal behaviour for a DSC resource is only to enforce the properties that are part of the configuration. Due to that the property PhysicalPath is mandatory all configurations must set it regardless if it should be enforced or not. Since your configuration must set the property, even thought you do not want to enforce it, you get the issue that PhysicalPath is overwritten with the wrong value. By removing that the parameter is mandatory, since there are scenarios where a configuration does not ant to enforce it, we solve that problem. This assumes that your configuration never create the actual object that depends on PysicalPath. Because if a configuration should create the object then we want to enforce the property, because then you say that there should always be a object with the pysical path 'X', and no other pysical path.

A property could be added to the Website/WebApplication to set the behavior. For example: SetPhysicalPath = $false.

You mean we could add the boolean parameter OnlyUsePhysicalPathOnCreate. Not sure that is the right way to go since we do want to enforce it if it is part of the configuration, though I have seen resources implement such a way, but only for mandatory parameter, and in this case we do not need to have it mandatory. But if the community likes the idea, sure. 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement The issue is an enhancement request. help wanted The issue is up for grabs for anyone in the community.
Projects
None yet
Development

No branches or pull requests

3 participants