xlab-si / xopera-opera

xOpera orchestrator compliant with TOSCA YAML v1.3 in the making
https://xlab-si.github.io/xopera-docs/
Apache License 2.0
35 stars 14 forks source link

Resolve the latest CLI command bugs #220

Closed anzoman closed 2 years ago

anzoman commented 2 years ago

Description

I've discovered some issues with CLI commands in our latest opera version 0.6.7. I'm listing them below:

Steps

(.venv) anzoman@ubuntu:~/Desktop/xopera-examples/misc/hello-world$ opera info
Traceback (most recent call last):
  File "/home/anzoman/Desktop/xopera-examples/.venv/bin/opera", line 8, in <module>
    sys.exit(main())
  File "/home/anzoman/Desktop/xopera-examples/.venv/lib/python3.9/site-packages/opera/cli.py", line 47, in main
    return args.func(args)
  File "/home/anzoman/Desktop/xopera-examples/.venv/lib/python3.9/site-packages/opera/commands/info.py", line 55, in _parser_callback
    outs = info(PurePath(csar_path), storage)
  File "/home/anzoman/Desktop/xopera-examples/.venv/lib/python3.9/site-packages/opera/commands/info.py", line 97, in info
    info_dict["csar_metadata"] = csar_meta.to_dict()
AttributeError: 'NoneType' object has no attribute 'to_dict'
(.venv) anzoman@ubuntu:~/Desktop/xopera-examples/misc/hello-world$ opera package .
Traceback (most recent call last):
  File "/home/anzoman/Desktop/xopera-examples/.venv/bin/opera", line 8, in <module>
    sys.exit(main())
  File "/home/anzoman/Desktop/xopera-examples/.venv/lib/python3.9/site-packages/opera/cli.py", line 47, in main
    return args.func(args)
  File "/home/anzoman/Desktop/xopera-examples/.venv/lib/python3.9/site-packages/opera/commands/package.py", line 57, in _parser_callback
    output_package = package(PurePath(args.service_template_folder), csar_output, PurePath(args.service_template),
  File "/usr/lib/python3.9/pathlib.py", line 675, in __new__
    return cls._from_parts(args)
  File "/usr/lib/python3.9/pathlib.py", line 707, in _from_parts
    drv, root, parts = self._parse_args(args)
  File "/usr/lib/python3.9/pathlib.py", line 691, in _parse_args
    a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not NoneType

There are also cases when opera validate command fails because it cannot fully validate Ansible executors. I think that instead of validating executors by default we could validate only TOSCA and replace the current --tosca-only switch with --executors/-e switch.

Current behaviour

The CLI commands have some bugs.

Expected results

To fix the bugs in the CLI commands.

anzoman commented 2 years ago

These issues were successfully fixed in 87c913a02d4d4536a445bfccbf31ce6488654a64.