ENT-14319: Added function to initialize promise-type/-module-projects - #198
ENT-14319: Added function to initialize promise-type/-module-projects#198SimonThalvorsen wants to merge 1 commit into
Conversation
|
Thank you for submitting a PR! Maybe @craigcomstock can review this? |
olehermanse
left a comment
There was a problem hiding this comment.
Looks good so far, left some suggestions / feedback. Will have more when I test it.
|
LGTM 🚀 For some reason this does not work for me am I doing something wrong? |
@larsewi |
6a28fd8 to
37eb07b
Compare
larsewi
left a comment
There was a problem hiding this comment.
$ cfengine init --policy-module --with-input
Try to follow existing naming conventions, for example:
- compliance-report-lynis: Adds the lynis compliance report
- delete-files: Deletes files specified by the user
- inventory-etc-hosts: Adds inventory information based on the /etc/hosts file
- library-sshd-config: A library for working with sshd config, intended to be used by other modules.
Name of module [distribute-ssh-keys]:
Initialized empty Git repository in /home/larsewi/ntech/distribute-ssh-keys/.git/
Traceback (most recent call last):
File "/home/larsewi/.local/bin/cfengine", line 6, in <module>
sys.exit(main())
^^^^^^
File "/home/larsewi/ntech/cfengine-cli/src/cfengine_cli/main.py", line 416, in main
exit_code = _main()
^^^^^^^
File "/home/larsewi/ntech/cfengine-cli/src/cfengine_cli/main.py", line 408, in _main
return run_command_with_args(args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/larsewi/ntech/cfengine-cli/src/cfengine_cli/main.py", line 215, in run_command_with_args
return commands.init(args)
^^^^^^^^^^^^^^^^^^^
File "/home/larsewi/ntech/cfengine-cli/src/cfengine_cli/commands.py", line 59, in init
rc = init_policy_module(
^^^^^^^^^^^^^^^^^^^
File "/home/larsewi/ntech/cfengine-cli/src/cfengine_cli/initialize_project.py", line 112, in init_policy_module
config = _scaffold(
^^^^^^^^^^
File "/home/larsewi/ntech/cfengine-cli/src/cfengine_cli/initialize_project.py", line 162, in _scaffold
validate_config_raise_exceptions(config, empty_build_list_ok=True)
File "/home/larsewi/.local/share/pipx/venvs/cfengine/lib/python3.12/site-packages/cfbs/validate.py", line 319, in validate_config_raise_exceptions
validate_single_module("provides", name, module, config)
File "/home/larsewi/.local/share/pipx/venvs/cfengine/lib/python3.12/site-packages/cfbs/validate.py", line 863, in validate_single_module
_validate_module_input(name, module)
File "/home/larsewi/.local/share/pipx/venvs/cfengine/lib/python3.12/site-packages/cfbs/validate.py", line 698, in _validate_module_input
raise CFBSValidationError(
cfbs.utils.CFBSValidationError: Error in cfbs.json for module 'distribute-ssh-keys': "distribute-ssh-keys" is not an acceptable namespace, must match regex "[a-z_][a-z0-9_]+"
I'm guessing namespace should be canonicalized to distribute_ssh_keys
I think you are on an outdated commit? |
|
Works now. However, it seems like the formatter gets run after the commit and you end up with a diff. could you fix that? |
|
Also I think the README.md should be in the root of the repository. Maybe I'm wrong |
Ticket: ENT-14319 Changelog: None Signed-off-by: Simon Halvorsen <simon.halvorsen@northern.tech>
Fair enough, if you would create it as a module-git-repo you would want the README to the first thing you see. It will probably change over time (details, how to publish and so on) anyways so I do not think it matters that much at this point |
Ticket: ENT-14319
Changelog: None