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

Support tags on apply blocks #3371

Open
jameslikeslinux opened this issue Dec 27, 2024 · 0 comments
Open

Support tags on apply blocks #3371

jameslikeslinux opened this issue Dec 27, 2024 · 0 comments
Labels
Feature New features and improvements.

Comments

@jameslikeslinux
Copy link

Use Case

Tags are a core feature of Puppet. I use them to filter resources in a catalog to optimize long builds.

Describe the Solution You Would Like

Both bolt apply and the apply function take parameters to enable noop mode. It should be extended to take a tags parameter.

Describe Alternatives You've Considered

I considered refactoring my code to eliminate tags, but my use case doesn't support that. For workarounds, I tried setting the global tags setting like:

run_command('puppet config set tags foo', $target)
apply($target) { include module }
run_command('puppet config delete tags', $target)

and though I could see the tags = foo setting present on the target's main puppet.conf, it did not take effect during the apply block. A "working" but ugly workaround was to configure tags directly in the interpreter:

inventory.yaml

config:
  podman:
    interpreters:
      rb: ['/usr/bin/ruby', '-r', 'puppet', '-e', 'Puppet[:tags] = File.open("/.apply_tags", &:gets) if File.exist? "/.apply_tags"; load ARGV.shift']
run_command('sh -c "echo foo > /.apply_tags"', $target, 'Set Puppet tags')
apply($target) { include module }
run_command('rm /.apply_tags', $target, 'Clear Puppet tags')
@jameslikeslinux jameslikeslinux added the Feature New features and improvements. label Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New features and improvements.
Projects
None yet
Development

No branches or pull requests

1 participant