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

Add remove_resource function #245

Merged
merged 2 commits into from
Feb 18, 2025

Conversation

alexjfisher
Copy link
Member

No description provided.

@alexjfisher alexjfisher added the enhancement New feature or request label Feb 17, 2025
Comment on lines +46 to +49
scope.catalog.remove_resource(catalog_resource)
scope.compiler.resources.delete(catalog_resource)
Copy link
Member

Choose a reason for hiding this comment

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

can you maybe write a sentence or two what's the difference of catalog vs compiler here? Do horrible things happen when other resources depend on the one that's deleted?

Copy link
Member Author

Choose a reason for hiding this comment

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

scope.catalog is the same as scope.compiler.catalog.

https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/parser/scope.rb#L38-L41

I'll try to come up with some better explanation for these two lines though.

Copy link
Member Author

Choose a reason for hiding this comment

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

Horrible things? Not really. At the end of the catalog compilation process, if any resources mentioned in relationships have been removed, you get the standard Could not find resource error.

notify { ['foo','bar']: }

Notify['foo'] -> Notify['bar']

extlib::remove_resource(Notify['foo'])
Error: Could not find resource 'Notify[foo]' for relationship on 'Notify[bar]' on node example

Copy link
Member Author

Choose a reason for hiding this comment

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

I've added a comment and also split out the unrelated puppet-strings fixup into its own commit.

By using the `@summary` tag correctly, only that line is included in the
REFERENCE function index.
@alexjfisher alexjfisher merged commit 24be3a6 into voxpupuli:master Feb 18, 2025
5 checks passed
@alexjfisher alexjfisher deleted the remove_resource branch February 18, 2025 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants