Skip to content

Commit 7255f69

Browse files
ENT-14319: Added function to initialize promise-type/-module-projects
Ticket: ENT-14319 Changelog: None Signed-off-by: Simon Halvorsen <simon.halvorsen@northern.tech>
1 parent 0e2f53e commit 7255f69

3 files changed

Lines changed: 486 additions & 0 deletions

File tree

src/cfengine_cli/commands.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
from cfengine_cli.format import format_paths
1010
from cfengine_cli.utils import UserError
1111
from cfengine_cli.up import validate_config, up_do, resolve_templates
12+
from cfengine_cli.initialize_project import init_policy_module, init_promise_type
1213
from cf_remote.paths import cf_remote_dir
14+
from cfbs.commands import init_command
1315
from pydantic import ValidationError
1416

1517

@@ -49,6 +51,24 @@ def dev(subcommand, args) -> int:
4951
return dispatch_dev_subcommand(subcommand, args)
5052

5153

54+
def init(args):
55+
if args.with_input and not args.policy_module:
56+
raise UserError("--with-input can only be used together with --policy-module")
57+
58+
if args.policy_module:
59+
rc = init_policy_module(
60+
name=None,
61+
with_input=args.with_input,
62+
non_interactive=args.non_interactive,
63+
)
64+
return rc
65+
if args.promise_type:
66+
rc = init_promise_type(name=None)
67+
return rc
68+
69+
return init_command() # --policy-set, cfbs init, default
70+
71+
5272
def profile(args) -> int:
5373
data = None
5474
with open(args.profiling_input, "r") as f:

0 commit comments

Comments
 (0)