-
Notifications
You must be signed in to change notification settings - Fork 10
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-3953: added user input support for cfbs #122
Conversation
Thanks for submitting a pull request! Maybe @olehermanse can review this? |
3229acc
to
c09cc9a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks promising otherwise. Next is handling inputs on module updates and making sure everything works with dependencies (both when adding modules and updating them).
c34db5b
to
aa34825
Compare
ab5f123
to
8c8de21
Compare
f531d24
to
7ee5838
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- instead of
f` in one of the commit messages
Looks generally OK to me. I don't like the idea of how this whole thing works, but that's another story.
0d8e607
to
26d3e94
Compare
184f485
to
6735c27
Compare
cfbs/utils.py
Outdated
|
||
|
||
def canonify(string): | ||
return re.sub(r"[^a-zA-Z0-9_\200-\377]", "_", string) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably reference where this is from (in commit message).
This function is inspired by the `string_lib.c:CanonifyNameInPlace` function from libntech: ```C void CanonifyNameInPlace(char *s) { for (; *s != '\0'; s++) { if (!isalnum((unsigned char) *s)) { *s = '_'; } } } ``` I tested it with the CFEngine `canonify` function to see if it produces the same results. But it responds a little bit differently when using non-ASCII characters. E.g. the emoji 🐿️ is translated to `___` by CFEngine but `_` by this python function. One thing to note is that the `isalnum` function responds differently based on what locale is set on the system. Ticket: None Changelog: None Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
Ticket: None Changelog: None Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
`cfbs remove` now removes input data. `cfbs remove` now also writes multiline commit messages as default. Ticket: CFE-3953 Changelog: Title Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
Ticket: None Changelog: None Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
Removed `CFBSConfig` import from prompts.py so that `prompt_user` can be used in CFBSConfig.py. Ticket: None Changelog: None Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
Changed to use set difference instead off nested for loops. Ticket: None Changelog: None Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
Ticket: CFE-3953 Changelog: Title Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
`cfbs add` now prompts users whether or not they want to add input for modules that accept input. Ticket: CFE-3953 Changelog: Body Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
Ticket: None Changelog: Title Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
Ticket: None Changelog: None Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
Print message when trying to update a module that is already up to date. Ticket: None Changelog: None Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
My linter complained and said this was better. I don't know why, but I trust my linter. Ticket: None Changelog: None Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
Ticket: None Changelog: None Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
Ticket: CFE-3953 Changelog: Title Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
Ticket: CFE-3953 Changelog: None Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
Ticket: CFE-3953 Changelog: None Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
Created `merge_json` unit test to check my sanity while implementing the 'input' buildstep. Ticket: None Changelog: None Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
`cfbs build` now generates augments when it sees the 'input' in build steps. If there is no input associated with the 'input' build step, no operation is done. Ticket: CFE-3953 Changelog: Title Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
Print a warning when adding a module that already has input data in the module repository. In the future handle this properly. See ticket [CFE-4059](https://tracker.mender.io/browse/CFE-4059). Ticket: CFE-3953 Changelog: Print warning when adding a module that already has input data Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
Ticket: CFE-3953 Changelog: None Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
Ticket: CFE-3953 Changelog: None Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
cfbs --non-interactive add example-module | ||
cfbs --non-interactive input example-module | ||
grep '"response": "/tmp/testfile.txt"' ./example-module/input.json | ||
cfbs --non-interactive remove example-module |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably check here what remove did.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks for working on this!
Here are some example modules to test with cfbs-test-modules
cfbs input
commandcfbs remove
cfbs add
cfbs update
cfbs build