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

CFE-3990: Prompt user which bundle to run #133

Merged
merged 11 commits into from
Oct 20, 2022

Conversation

larsewi
Copy link
Contributor

@larsewi larsewi commented Oct 18, 2022

Demo:

$ tree .
.
├── bogus.cf
├── cfbs.json
└── doofus
    ├── doofus.cf
    └── foo
        └── foo.cf

2 directories, 4 files
$ cfbs add ./bogus.cf 
Which bundle should be evaluated (added to bundle sequence)?
 1. ./bogus.cf:bogus (default)
 2. (None)
 [1/2]: 1
Added module: ./bogus.cf
$ cfbs add ./doofus/
Which bundle should be evaluated (added to bundle sequence)?
 1. ./doofus/doofus.cf:doofus (default)
 2. ./doofus/foo/foo.cf:foobar
 3. ./doofus/foo/foo.cf:foobaz
 4. (None)
 [1/2/3/4]: 2
Added module: ./doofus/
$ cfbs build
--snip--
002 ./bogus.cf  : copy './bogus.cf' 'masterfiles/services/cfbs/bogus.cf'
002 ./bogus.cf  : policy_files 'services/cfbs/bogus.cf'
002 ./bogus.cf  : bundles 'bogus'
003 ./doofus/   : directory './' 'masterfiles/services/cfbs/doofus/'
003 ./doofus/   : policy_files 'services/cfbs/doofus/doofus.cf' 'services/cfbs/doofus/foo/foo.cf'
003 ./doofus/   : bundles 'foobar'
--snip--
$ sudo cfbs install
Installed to /var/cfengine/masterfiles
$ sudo /var/cfengine/bin/cf-agent -KIf update.cf
--snip--
$ sudo /var/cfengine/bin/cf-agent -KI
R: This is /var/cfengine/inputs/services/cfbs/bogus.cf:bogus!
R: This is /var/cfengine/inputs/services/cfbs/doofus/foo/foo.cf:foobar!

Ticket: CFE-3990
Changelog: None
Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
Added message to assert in `prompt_user` in order to make it easier to
debug when `default` is neither `None` nor in `choices`.

Ticket: None
Changelog: None
Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
cfbs now prompts user which bundle to run when adding a local module or
directory.

Ticket: CFE-3990
Changelog: Body
Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
Added unit test for utility function `merge_json` during some debugging
in order to make sure the function worked as I expected. Might as well
keep it.

Ticket: None
Changelog: None
Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
Removed autorun dependency added when creating module from local policy
file, and changed the destion from `/services/autorun/` to
`/services/cfbs/`.

Ticket: CFE-3990
Changelog: Body
Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
Remove logic that adds policy files to the inputs attribute in def.json.
Also the copy logic now keeps the directory hierachy of the module.

Ticket: CFE-3990
Changelog: Body
Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
Removed the warning printed when adding files not tagged with autorun.

Ticket: CFE-3990
Changelog: Body
Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
Added build step `policy_files` that adds policy files to inputs.

Ticket: CFE-3990
Changelog: Body
Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
Added build step `bundles` that adds bundles to the bundlesequence.

Ticket: CFE-3990
Changelog: Body
Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
Modify 010_local_add shell test to work with changes from CFE-3990.

Ticket: CFE-3990
Changelog: None
Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
Modify 016_add_folders shell test to work with changes from CFE-3990.

Ticket: CFE-3990
Changelog: None
Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
@larsewi larsewi marked this pull request as ready for review October 18, 2022 10:05
Copy link
Member

@olehermanse olehermanse left a comment

Choose a reason for hiding this comment

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

Looks good, thanks for working on this!

@olehermanse olehermanse merged commit e9650c6 into cfengine:master Oct 20, 2022
cfbs/cfbs_config.py Show resolved Hide resolved
cfbs/cfbs_config.py Show resolved Hide resolved
@larsewi larsewi mentioned this pull request Oct 25, 2022
@larsewi larsewi deleted the CFE-3990 branch October 28, 2022 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants