Skip to content
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

Add support for general api token #54

Merged
merged 4 commits into from
Jul 7, 2023

Conversation

mjtice
Copy link
Contributor

@mjtice mjtice commented Jul 6, 2023

No description provided.

@mjtice mjtice requested review from a team and floatingstatic as code owners July 6, 2023 16:23
@mjtice mjtice requested review from m4dcoder and removed request for a team July 6, 2023 16:23
@floatingstatic
Copy link
Collaborator

Hi @mjtice thanks for the contribution. This looks pretty good. I loaded this in my st2-docker test environment and ran some quick tests. All of the actions work beautifully with the new auth method however we also need to update the sensor code in your branch. Somewhere around here:

https://github.com/mjtice/stackstorm-jira/blob/a36af44c6b0c5d9ae37d228aec4110cae47f1daf/sensors/jira_sensor_for_apiv2.py#L59-L63

Otherwise we get an exception when the sensor starts as it is unaware of the new api_token auth method.

st2sensorcontainer_1   | 2023-07-07 01:36:45,908 ERROR [-]   File "/opt/stackstorm/packs/jira/sensors/jira_sensor.py", line 67, in setup
st2sensorcontainer_1   |
st2sensorcontainer_1   | 2023-07-07 01:36:45,908 ERROR [-]
st2sensorcontainer_1   | 2023-07-07 01:36:45,908 ERROR [-] raise Exception(msg)
st2sensorcontainer_1   | 2023-07-07 01:36:45,908 ERROR [-]
st2sensorcontainer_1   |
st2sensorcontainer_1   | 2023-07-07 01:36:45,908 ERROR [-] Exception
st2sensorcontainer_1   | 2023-07-07 01:36:45,908 ERROR [-] :
st2sensorcontainer_1   | 2023-07-07 01:36:45,908 ERROR [-] ('You must set auth_method to either "oauth"', 'or "basic" your jira.yaml config file.')
st2sensorcontainer_1   | 2023-07-07 01:36:45,908 ERROR [-]
st2sensorcontainer_1   |

If you wouldn't mind fixing that up, I see no issues merging this. Thanks again!

@floatingstatic
Copy link
Collaborator

Sorry one other small detail you will want to update this in sensors/jira_sensor_for_apiv2.py as well as sensors/jira_sensor.py but the change is basically the same in both files. Thanks!

@mjtice
Copy link
Contributor Author

mjtice commented Jul 7, 2023

I added the api_token auth method into the sensors. They were also missing 'pat' and 'cookie' so I added them, too.

Copy link
Collaborator

@floatingstatic floatingstatic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Sensor is now working in my test env. Thanks for adding the missing auth methods in the sensor as well, much appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants