ENT-14320: Wrapped most of the remaining cf-remote/cfbs commands into CFEngine-cli - #209
ENT-14320: Wrapped most of the remaining cf-remote/cfbs commands into CFEngine-cli#209SimonThalvorsen wants to merge 8 commits into
Conversation
…dules or update cfbs project
4eef420 to
e8fa6bf
Compare
… is specified Ticket: None Changelog: Title Signed-off-by: Simon Halvorsen <simon.halvorsen@northern.tech>
cd03c10 to
a26b902
Compare
|
Thanks for submitting a PR! Maybe @larsewi can review this? |
| description="A wrapper around the cf-remote `build`-function with some added niceties", | ||
| ) | ||
| sp.add_argument( | ||
| "--non-interactive", |
There was a problem hiding this comment.
Isn't the whole point with CFEngine CLI that it should not be used in scripts? I feel options like --non-interactive kind of works against that. Do we already have these options for other sub commands?
| for x in [require_executable("cf-agent", h)] | ||
| } or None | ||
|
|
||
| # TODO/WOULD be nice: Deploy without run |
There was a problem hiding this comment.
You can reference CFE-4704
|
|
||
| if prompt_yes_no("Run policy set now?", default=True, non_interactive=non_interactive): | ||
| for hub in hubs: | ||
| hubs[hub].run("-KIf update.cf", "-KI") |
There was a problem hiding this comment.
Ref. comment above. Will this run the agent again?
| def parse_wrapper_args(subp: argparse._SubParsersAction): | ||
| moduleinfo_parser = subp.add_parser( | ||
| "moduleinfo", | ||
| help="Shows information about your cfbs-project or a specific module", |
There was a problem hiding this comment.
s/your cfbs-project/your cfbs-project/
| if modules == []: | ||
| try: | ||
| status_command() | ||
| except Exception as e: |
There was a problem hiding this comment.
Can't you just check of you are inside a cfbs-project, rather than catching all exceptions? This would hide bugs like out of bound array access, etc.
| return cfengine_commands.build(args.hub, args.non_interactive) | ||
| if args.command == "deploy": | ||
| return cfengine_commands.deploy(args.hub, args.masterfiles, args.non_interactive) | ||
| if args.command == "input": |
There was a problem hiding this comment.
At some point, these should be a dictionary look-ups with functions. I think it's also possible to add functions directly into the argument parser. However, this is probably out of scope for this PR.
| data = _host_info(ident.location) | ||
| if not data: | ||
| return None | ||
| # band-aid: hostinfo has no path for cf-hub, so assume it's on PATH |
There was a problem hiding this comment.
Maybe you can create a follow-up ticket for this?
No description provided.