-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multi profiles #19
base: master
Are you sure you want to change the base?
Multi profiles #19
Conversation
…ped version to 0.9.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is coming along nicely, but it can be simplified quite a bit.
The configuration allows for multi jira definitions. This will allow for the automation to multiple Jira instances from a single stackstorm instance. | ||
|
||
Profiles are defined within the ``profile`` section of the configuration and they accept the same parameters as the inline options. | ||
This option takes in an array of profile options. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using an array of profile dictionaries:
profiles:
- name: profile_one
# ...
- name: profile_two
# ...
is kind of clunky. Using a dictionary of profile dictionaries would be cleaner:
profiles:
profile_one:
# ...
profile_two:
# ...
Using a dictionary also means that you don't have to specify a default_profile
- the inline values function as the default profile values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, I looked into this, but i wasn't sure how to define a dynamic key within the config schema file.
Could you point me in the right direction on how to define that and i'll look into changing it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh gotcha. Dictionaries are called "objects" in JSONSchema.
My review comment later on contains a good example of what you can/should do. All you should need to do is:
- add the
<<: &root_anchor
after the---
line, before all of the existing keys - indent the existing keys
- copy the
profiles
key from my example intoconfig.schema.yaml
Let me know if you have any further questions - this is easily the most confusing part of a pack.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw your example below, i did implement it. However it appears there is a bug.
If i try and use an encrypted key store, it ignores the secret value and doesn't decrypt the password.
This happens when using anchors or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have merged my changes. However there still appears to be a bug with secret key values. Maybe i am missing something you'll noticed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does st2kv.system.jira_prod_pass
get decrypted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@blag
Yes the jira_prod_pass gets decrypted, however jira_dev_pass doesnt.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pdenning Sorry I don't have more to update, but at this point I believe this isn't working due to an undiscovered bug in StackStorm. I haven't had time to reproduce the issue or add a similar config to StackStorm's test fixtures yet, but I haven't forgotten about it.
If you managed to get it working, then please resolve this conversation, but if not I'd like to fix the bug in StackStorm itself (st2 repo) before we merge this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found the bug. In order to decrypt the key, the schema needs to declare secret: true
, BUT, the config loader does not look at any schemas under additionalProperties
, so the profiles
object is effectively schema-less:
https://github.com/StackStorm/st2/blob/8496bb2407b969f0937431992172b98b545f6756/st2common/st2common/util/config_loader.py#L133-L137
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm working on a fix for this here: StackStorm/st2#5225
@armab No, this isn't working as expected and I still need to get to the bottom of it. |
|
As discussed in https://forum.stackstorm.com/t/pack-configs-different-hosts-credentials/398
This adds multi profile support to the jira pack actions.
Sensor is not changed.