StackStorm / StackStorm/st2

st2 pack config <pack_name> does not handle object references

Open
#3,455 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

complexity:medium feature
Dominant language
Python
Stars
6.5k
Forks
787
PR merge metrics
No merged PRs in 30d

Description

When running st2 pack config vsphere .... if you look at the example config (https://github.com/StackStorm-Exchange/stackstorm-vsphere/blob/master/vsphere.yaml.example) and the schema (https://github.com/StackStorm-Exchange/stackstorm-vsphere/blob/master/config.schema.yaml) it does not seem to be generating a config that matches the example:

[root@stackstorm ~]# st2 pack config vsphere
ssl_verify (boolean) [y]: y
vcenters.passwd (secret): ********
vcenters.host: hostname
vcenters.port (integer): 1234
vcenters.user: username
taskinfo.vsphere [default]: 
taskinfo.tasknum (integer) [1]: 
---
Do you want to preview the config in an editor before saving? [y]: n
---
Do you want me to save it? [y]: y
+----------+------------------------------------+
| Property | Value                              |
+----------+------------------------------------+
| pack     | vsphere                            |
| values   | {                                  |
|          |     "ssl_verify": true,            |
|          |     "vsphere": {},                 |
|          |     "vcenters": {                  |
|          |         "passwd": "password",      |
|          |         "host": "hostname",        |
|          |         "port": 1234,              |
|          |         "user": "username"         |
|          |     },                             |
|          |     "sensors": {                   |
|          |         "taskinfo": {              |
|          |             "vsphere": "default",  |
|          |             "tasknum": 1           |
|          |         }                          |
|          |     }                              |
|          | }                                  |
+----------+------------------------------------+

The yaml file that is generated looks like:

[root@stackstorm ~]# cat /opt/stackstorm/configs/vsphere.yaml 
sensors:
  taskinfo:
    tasknum: 1
    vsphere: default
ssl_verify: true
vcenters:
  host: hostname
  passwd: password
  port: 1234
  user: username
vsphere: {}

What i want it to look like:

[root@stackstorm ~]# cat /opt/stackstorm/configs/vsphere.yaml 
sensors:
  taskinfo:
    tasknum: 1
    vsphere: default
ssl_verify: true
vsphere: 
  some-name-i-could-enter:
    host: hostname
    passwd: password
    port: 1234
    user: username

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the generated output from st2 pack config vsphere with vsphere.yaml.example and config.schema.yaml in the linked stackstorm-vsphere pack. Reproduce the object-reference case and verify that the saved YAML nests the entered name under vsphere while preserving the vcenter fields.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.