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

Expose delete as a direct dsc resource operation #290

Closed
SteveL-MSFT opened this issue Dec 26, 2023 · 4 comments · Fixed by #382
Closed

Expose delete as a direct dsc resource operation #290

SteveL-MSFT opened this issue Dec 26, 2023 · 4 comments · Fixed by #382
Assignees
Labels
Issue-Enhancement The issue is a feature or idea Partner

Comments

@SteveL-MSFT
Copy link
Member

Summary of the new feature / enhancement

It may be simpler for DSC resource implementations to implement delete rather than have logic as part of set to handle _exist. We can still support _exist as a special keyword in configuration where dsc knows to call delete if implemented.

PowerShell resources already implement ensure differently, so that won't change either way.

Proposed technical implementation details (optional)

No response

@SteveL-MSFT SteveL-MSFT added Issue-Enhancement The issue is a feature or idea Need-Review Partner labels Dec 26, 2023
@michaeltlombardi
Copy link
Collaborator

I'm not sure about this - it does move a little bit away from the underlying state management model of an instance + properties - if you have delete, why not create (don't update if exist) or modify (don't create if not exist)?

It seems like the sort of thing I might expect a higher order tool to implement, rather than a resource or DSC itself.

@SteveL-MSFT
Copy link
Member Author

@michaeltlombardi the idea is that this can simplify resource authoring as you can have clear separation of set (CreateOrUpdate) and delete whereas, for example, in the registry resource, I basically have a bunch of if statements to check if _exist is passed in and it would simplify the code by having delete a separate code path. For end users, they can call delete directly via dsc resource delete ..., but if using config, it would be abstracted so deletes can occur with create/update within the same config.

@SteveL-MSFT
Copy link
Member Author

We should allow resources to implement _exist directly, but if the resource implements delete then dsc will use that to handle _exist rather than passing that to the resource.

@SteveL-MSFT
Copy link
Member Author

Discussed with @mgreenegit and we agreed to move forward with this proposal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Enhancement The issue is a feature or idea Partner
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants