st2 icon indicating copy to clipboard operation
st2 copied to clipboard

pack.yaml dependencies not working for gt\lt only for eq

Open DavidMeu opened this issue 4 years ago • 3 comments

Trying to install a pack with one dependency: st2 3.4.1, on Python 3.6.9 Relevant doc: pack-dependencies dependencies in pack.yaml:

dependencies:
  - some_pack>=1.1.1

Full output:

{
  "output": {
    "packs_list": [
      "main_pack"
    ],
    "message": "",
    "conflict_list": [],
    "warning_list": null
  },
  "errors": [
    {
      "type": "error",
      "message": "Execution failed. See result for details.",
      "task_id": "download_pack",
      "result": {
        "stdout": "",
        "stderr": "Traceback (most recent call last):\n  File \"/opt/stackstorm/st2/lib/python3.6/site-packages/python_runner/python_action_wrapper.py\", line 334, in <module>\n    obj.run()\n  File \"/opt/stackstorm/st2/lib/python3.6/site-packages/python_runner/python_action_wrapper.py\", line 193, in run\n    output = action.run(**self._parameters)\n  File \"/opt/stackstorm/packs/packs/actions/pack_mgmt/download.py\", line 89, in run\n    return self._validate_result(result=result, repo_url=pack_url)\n  File \"/opt/stackstorm/packs/packs/actions/pack_mgmt/download.py\", line 110, in _validate_result\n    raise Exception(message)\nException: The pack has not been downloaded from \"None\".\n\nErrors:\nNo record of the \"some_pack>\" pack in the index.\n",
        "exit_code": 1,
        "result": "None"
      }
    }
  ]
}

Full output in CLI:

        [ succeeded ] init_task
        [ succeeded ] download_pack
        [ succeeded ] make_a_prerun
        [ succeeded ] get_pack_dependencies
        [ succeeded ] check_dependency_and_conflict_list
        [  failed   ] download_pack

id: 610ab23bb9c6ebf292ba7a83
action.ref: packs.install
parameters:
  packs:
  - main_pack=dependencies_check
status: failed
start_timestamp: Wed, 04 Aug 2021 15:28:58 UTC
end_timestamp: Wed, 04 Aug 2021 15:29:16 UTC
result:
  errors:
  - message: Execution failed. See result for details.
    result:
      exit_code: 1
      result: None
      stderr: "Traceback (most recent call last):
  File "/opt/stackstorm/st2/lib/python3.6/site-packages/python_runner/python_action_wrapper.py", line 334, in <module>
    obj.run()
  File "/opt/stackstorm/st2/lib/python3.6/site-packages/python_runner/python_action_wrapper.py", line 193, in run
    output = action.run(**self._parameters)
  File "/opt/stackstorm/packs/packs/actions/pack_mgmt/download.py", line 89, in run
    return self._validate_result(result=result, repo_url=pack_url)
  File "/opt/stackstorm/packs/packs/actions/pack_mgmt/download.py", line 110, in _validate_result
    raise Exception(message)
Exception: The pack has not been downloaded from "None".

Errors:
No record of the "some_pack>" pack in the index.
"
      stdout: ''
    task_id: download_pack
    type: error
  output:
    conflict_list: []
    message: ''
    packs_list:
    - main_pack
    warning_list: null
+--------------------------+------------------------+----------------------+----------------------+------------------+
| id                       | status                 | task                 | action               | start_timestamp  |
+--------------------------+------------------------+----------------------+----------------------+------------------+
| 610ab2419daca84b6f154059 | succeeded (0s elapsed) | init_task            | core.noop            | Wed, 04 Aug 2021 |
|                          |                        |                      |                      | 15:29:05 UTC     |
| 610ab2429daca84b6f154069 | succeeded (5s elapsed) | download_pack        | packs.download       | Wed, 04 Aug 2021 |
|                          |                        |                      |                      | 15:29:06 UTC     |
| 610ab2479daca84b6f154079 | succeeded (1s elapsed) | make_a_prerun        | packs.virtualenv_pre | Wed, 04 Aug 2021 |
|                          |                        |                      | run                  | 15:29:11 UTC     |
| 610ab2489daca84b6f154089 | succeeded (1s elapsed) | get_pack_dependencie | packs.get_pack_depen | Wed, 04 Aug 2021 |
|                          |                        | s                    | dencies              | 15:29:12 UTC     |
| 610ab2499daca84b6f154099 | succeeded (1s elapsed) | check_dependency_and | core.noop            | Wed, 04 Aug 2021 |
|                          |                        | _conflict_list       |                      | 15:29:13 UTC     |
| 610ab24a9daca84b6f1540a9 | failed (2s elapsed)    | download_pack        | packs.download       | Wed, 04 Aug 2021 |
|                          |                        |                      |                      | 15:29:14 UTC     |
+--------------------------+------------------------+----------------------+----------------------+------------------+

DavidMeu avatar Aug 04 '21 15:08 DavidMeu

Do we support version operators other than equality? I thought we did but I'm not finding any tests for that, and I'm digging through the code and haven't yet found where we parse individual dependency specifiers. My search is ongoing.

blag avatar Aug 04 '21 17:08 blag

Nope, it looks like we only support equality operators for specifying pack dependencies:

  • https://github.com/StackStorm/st2/blob/911e2e16d7a356df1bb3992bb9d06829db36ab05/st2common/st2common/constants/pack.py#L48
  • https://github.com/StackStorm/st2/blob/911e2e16d7a356df1bb3992bb9d06829db36ab05/contrib/packs/actions/pack_mgmt/get_pack_dependencies.py#L113

@DavidMeu Sorry for misleading you!

I'm naïvely going to say: this shouldn't be super duper difficult to implement, and I think it would have a good deal of benefit for users.

blag avatar Aug 04 '21 17:08 blag

Thanks for contributing to this issue. As it has been 90 days since the last activity, we are automatically marking is as stale. If this issue is not relevant or applicable anymore (problem has been fixed in a new version or similar), please close the issue or let us know so we can close it. On the contrary, if the issue is still relevant, there is nothing you need to do, but if you have any additional details or context which would help us when working on this issue, please include it as a comment to this issue.

stale[bot] avatar Apr 16 '22 05:04 stale[bot]