Skip to content

ENT-14320: Wrapped most of the remaining cf-remote/cfbs commands into CFEngine-cli - #209

Open
SimonThalvorsen wants to merge 8 commits into
cfengine:mainfrom
SimonThalvorsen:ENT-14320
Open

ENT-14320: Wrapped most of the remaining cf-remote/cfbs commands into CFEngine-cli#209
SimonThalvorsen wants to merge 8 commits into
cfengine:mainfrom
SimonThalvorsen:ENT-14320

Conversation

@SimonThalvorsen

Copy link
Copy Markdown
Contributor

No description provided.

@SimonThalvorsen
SimonThalvorsen marked this pull request as draft August 7, 2026 14:42
… is specified

Ticket: None
Changelog: Title

Signed-off-by: Simon Halvorsen <simon.halvorsen@northern.tech>
@SimonThalvorsen
SimonThalvorsen marked this pull request as ready for review August 7, 2026 15:06
@cf-bottom

Copy link
Copy Markdown

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",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

s/your cfbs-project/your cfbs-project/

if modules == []:
try:
status_command()
except Exception as e:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment thread src/cfengine_cli/main.py
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":

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe you can create a follow-up ticket for this?

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