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

Enable and Disable Hypervisor in Openstack StacksStorm Action #289

Merged
merged 14 commits into from
Dec 12, 2024

Conversation

Dmitry-Popovichev
Copy link
Contributor

Description:

Created the Stackstorm action runner, workflow.py files and api call files to enable and disable hypervisors in openstack using stackstorm. Additionally added the unit tests to test the .py files.

Submitter:

Have you (where applicable):

  • Added unit tests? Yes
  • Checked the latest commit runs on Dev? Yes

Reviewer

Does this PR:

  • Place non-StackStorm code into the lib directory?
  • Have unit tests for the action/sensor and lib layers?
  • Have clear and obvious action parameter names and descriptions?

I created two actions, one for enabling and disabling the Nova Compute service on a Hypervisor. This passes the user inputs into a workflow which calls the openstack api to disable the spesified service.
Installing my repo/actions failed on the action, testing what needs fixing.
Cleaned up the type hints, print statements and renamed the workflow to follow a more generic name for reusibility. Renamed all of the references accordingly.
Unit testing all of the workflows and functions. Also renamed a few files and cleaned up some of the code.
Copy link

codecov bot commented Dec 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.26%. Comparing base (efd769a) to head (c7e3ae5).
Report is 16 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #289      +/-   ##
==========================================
+ Coverage   98.24%   98.26%   +0.01%     
==========================================
  Files         239      243       +4     
  Lines        9028     9105      +77     
  Branches      529      531       +2     
==========================================
+ Hits         8870     8947      +77     
  Misses        137      137              
  Partials       21       21              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@khalford khalford left a comment

Choose a reason for hiding this comment

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

Looks great. Just some small things.

About comments:
Personally I wouldn't put comments in the code unless you need to explain what a very complicated statement does I.E lambda functions. In your case it's just grouping together blocks of code and naming them. Your code should be understandable by it's structure and layout without comments. Feel free to ignore me if you think they are beneficial to yourself and others.

About the comment I made on raising an error rather than returning none. @anish-mudaraddi Do you have any thoughts on this? I am not completely aware of how the rest of the openstack api is written.

lib/openstack_api/openstack_service.py Outdated Show resolved Hide resolved
lib/openstack_api/openstack_service.py Outdated Show resolved Hide resolved
lib/openstack_api/openstack_service.py Outdated Show resolved Hide resolved
lib/openstack_api/openstack_service.py Outdated Show resolved Hide resolved
lib/workflows/hv_service_actions.py Outdated Show resolved Hide resolved
Dmitry-Popovichev and others added 4 commits December 11, 2024 15:04
@Dmitry-Popovichev Dmitry-Popovichev added the python Pull requests that update Python code label Dec 11, 2024
lib/openstack_api/openstack_service.py Outdated Show resolved Hide resolved
lib/openstack_api/openstack_service.py Outdated Show resolved Hide resolved
tests/lib/workflows/test_hv_service_actions.py Outdated Show resolved Hide resolved
tests/lib/workflows/test_hv_service_actions.py Outdated Show resolved Hide resolved
To help user understand if the action has failed. Additional code refactoring.
To help users understand if the action has failed. Additional code refactoring.
@Dmitry-Popovichev Dmitry-Popovichev merged commit 1e22fb8 into main Dec 12, 2024
14 checks passed
@Dmitry-Popovichev Dmitry-Popovichev deleted the enable-disable-HV-action branch December 12, 2024 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python Pull requests that update Python code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants