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 a bolt task to setup shell completion #289

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

smortex
Copy link
Member

@smortex smortex commented Dec 9, 2021

This is a building block that might be used when/if we want to add Bolt tasks / plans to setup Choria on nodes not managed by Puppet, in particular client nodes.

Currently our systems administrator manually add the choria repo and install the software, but this is not enough to have shell completion and we might need to update it from time to time.

Add a bolt task that make managing the completions easier:

romain@desktop-fln40kq ~ % bolt task run choria::completion -t localhost --run-as root
Started on localhost...
Finished on localhost:
  Task completed successfully with no result
Successful on 1 target: localhost
Ran on 1 target in 1.31 sec
romain@desktop-fln40kq ~ %

@@ -0,0 +1,4 @@
#!/bin/sh
mkdir -p /usr/share/bash-completion /usr/share/zsh/vendor-completions
Copy link
Member

Choose a reason for hiding this comment

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

Does tasks have no way to be OS aware? I am not sure this is a valid path for, lets say, BSD?

Copy link
Member Author

Choose a reason for hiding this comment

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

Unfortunately, while I would love some data to be gathered with hiera, this is not currently supported. The FreeBSD package the completions, but it is indeed better to overwrite these files (with same content) rather than pollute the system if the task happen to be run there.

I reworked the code to look for completion directories and if found install completion there. Not ideal, but maybe a bit less worse?

Copy link
Member

Choose a reason for hiding this comment

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

OK, seems better :)

I wonder if this is the best place for it though - like its the only place at present - but do you maybe have other similar tasks? Like a bag or random useful choria related tasks?

This is a building block that might be used when/if we want to add Bolt
tasks / plans to setup Choria on nodes not managed by Puppet, in
particular client nodes.

Currently our systems administrator manually add the choria repo and
install the software, but this is not enough to have shell completion
and we might need to update it from time to time.

Add a bolt task that make managing the completions easier:

```
bolt task run choria::completion -t localhost --run-as root
```
@smortex smortex marked this pull request as draft February 25, 2022 01:04
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.

None yet

2 participants