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

Created Argparse user method. #106

Merged
merged 26 commits into from
Oct 30, 2023
Merged

Created Argparse user method. #106

merged 26 commits into from
Oct 30, 2023

Conversation

khalford
Copy link
Member

This method allows a user to run a python script from the terminal with parameters to upload data from a csv into Netbox. There are lib code changes as the code hasn't been tested with a Netbox connection in a while.

The underlying code hasn't been tested in a while with a real netbox connection. These changes fix issues allowing devices to be created.
This keeps the code more organised and readable.
This is clearer when using imported methods because it shows api as an argument and not netbox.
Moved argparse logic into an independent function. Made a function to use the new class and do the methods.
This makes sure pytest doesn't try to run setup.py as it does not need to be run or tested.
Now .pylintrc only contains necessary disabled warnings. Added docstrings.
When formatting data in dictionaries. 2 enums files are used to provide the correct netbox attribute for a category of data. When choosing which enum to search the key value was not in uppercase like the enums values.
Changed classes to accept "api" parameter rather than netbox.
Also added some pretty print statements to describe what is happening when  the script is run.
@codecov-commenter
Copy link

codecov-commenter commented Oct 20, 2023

Codecov Report

Attention: 70 lines in your changes are missing coverage. Please review.

Comparison is base (3787bb5) 96.52% compared to head (3266780) 73.38%.
Report is 94 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master     #106       +/-   ##
===========================================
- Coverage   96.52%   73.38%   -23.15%     
===========================================
  Files          16       13        -3     
  Lines        1036      263      -773     
===========================================
- Hits         1000      193      -807     
- Misses         36       70       +34     
Flag Coverage Δ
rabbit_consumer ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
Pynetbox_Data_Uploader/lib/enums/dcim_device_id.py 100.00% <100.00%> (ø)
...etbox_Data_Uploader/lib/enums/dcim_device_no_id.py 100.00% <100.00%> (ø)
...etbox_Data_Uploader/lib/netbox_api/netbox_check.py 100.00% <100.00%> (ø)
...box_Data_Uploader/lib/netbox_api/netbox_connect.py 100.00% <100.00%> (ø)
...tbox_Data_Uploader/lib/netbox_api/netbox_create.py 100.00% <100.00%> (ø)
Pynetbox_Data_Uploader/tests/test_csv_to_dict.py 100.00% <100.00%> (ø)
Pynetbox_Data_Uploader/tests/test_netbox_check.py 100.00% <100.00%> (ø)
...ynetbox_Data_Uploader/tests/test_netbox_connect.py 100.00% <100.00%> (ø)
Pynetbox_Data_Uploader/tests/test_netbox_create.py 100.00% <100.00%> (ø)
Pynetbox_Data_Uploader/tests/test_netbox_data.py 71.42% <71.42%> (ø)
... and 3 more

... and 16 files with indirect coverage changes

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

@khalford khalford marked this pull request as ready for review October 20, 2023 11:50
@RWhiting78 RWhiting78 self-assigned this Oct 30, 2023
@RWhiting78 RWhiting78 self-requested a review October 30, 2023 09:16
@RWhiting78 RWhiting78 removed their assignment Oct 30, 2023
@meoflynn meoflynn merged commit 1c70fb3 into stfc:master Oct 30, 2023
2 checks passed
@khalford khalford deleted the argparse_user branch October 30, 2023 09:29
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.

4 participants