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 delete_namespace Method and Establish Namespace Documentation #500

Merged
merged 5 commits into from Jul 18, 2019

Conversation

@drewmullen
Copy link
Contributor

commented Jul 15, 2019

fixes: #472

add delete_namespace function

fix http request documented for create_namespace

add usage documentation for namespaces

added installation / setup information for testing contributions and doctests

@drewmullen drewmullen requested a review from jeffwecan Jul 15, 2019

@drewmullen drewmullen requested a review from hvac/hvac-maintainers as a code owner Jul 15, 2019

@jeffwecan
Copy link
Collaborator

left a comment

For what it is worth, I was actually pondering using this class as an opportunity to experiment with moving away from separate docts + doctests that are maintained explicitly to a model where the class docstrings include all documentation and doctest blocks. If that pans out, the idea would be that the docs/ entries just become autodoc macros.

None of that precludes filling in the docs this way, just dropping that thought here since you beat me to backfilling this content. :D

Examples
````````

.. testcode:: sys_mount

This comment has been minimized.

Copy link
@jeffwecan

jeffwecan Jul 15, 2019

Collaborator

This sys_mount label should most likely be updated. You can think of those doctest labels as unittest test classes. I.e., to avoid negative interactions between unrelated test cases, you want to keep them segmented in most all cases.

@drewmullen drewmullen force-pushed the drewmullen:namespace-docs-and-delete branch from e2af9c3 to 0e7ab14 Jul 15, 2019

@codecov-io

This comment has been minimized.

Copy link

commented Jul 15, 2019

Codecov Report

Merging #500 into develop will decrease coverage by 0.07%.
The diff coverage is 25%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #500      +/-   ##
===========================================
- Coverage    83.31%   83.23%   -0.08%     
===========================================
  Files           53       53              
  Lines         2918     2922       +4     
===========================================
+ Hits          2431     2432       +1     
- Misses         487      490       +3
Impacted Files Coverage Δ
hvac/api/system_backend/namespace.py 78.57% <25%> (-21.43%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9748ed8...6ce243c. Read the comment docs.

@drewmullen drewmullen force-pushed the drewmullen:namespace-docs-and-delete branch from a9ae9aa to c309f80 Jul 15, 2019

fix list() in doctest
fix test vars (url, token)

@drewmullen drewmullen force-pushed the drewmullen:namespace-docs-and-delete branch 3 times, most recently from 5c74d1e to 9ab3aac Jul 15, 2019

namespaces persist through entire file, removing duplicates
add unique ns create to list function

fix import for create_namespace call

skip if not enterprise

@drewmullen drewmullen force-pushed the drewmullen:namespace-docs-and-delete branch from 9ab3aac to dc1a15e Jul 16, 2019

@drewmullen drewmullen requested a review from jeffwecan Jul 16, 2019

@@ -2,13 +2,28 @@

Feel free to open issues and/or pull requests with additional features or improvements! For general questions about contributing to hvac that don't fit in the scope of a GitHub issue, and for any folks are interested in becoming a maintainer of hvac, please feel free to join our gitter chat room for discussions at [gitter.im/hvac/community](https://gitter.im/hvac/community): [![Gitter chat](https://badges.gitter.im/hvac/community.png)](https://gitter.im/hvac/community)

## Typical Devevelopment Environment Setup

This comment has been minimized.

Copy link
@jeffwecan

jeffwecan Jul 16, 2019

Collaborator

👍

@@ -37,7 +37,7 @@ def configure_access(self, address, token, scheme="http", mount_point=DEFAULT_MO
return self._adapter.post(
url=api_path,
json=params,
).json()

This comment has been minimized.

Copy link
@jeffwecan

jeffwecan Jul 16, 2019

Collaborator

Mind breaking out these commits to another PR? Since PR's are being used for auto-generated GitHub release notes / changlog entries at this point, it is nice to keep em logically distinct.


# Create namespace team1/app1 where app1 is a child of team1
client2 = hvac.Client(url='https://127.0.0.1:8200', namespace="team1")
client2.sys.create_namespace(path="app1")

This comment has been minimized.

Copy link
@jeffwecan

jeffwecan Jul 16, 2019

Collaborator

For what it is worth, you can also have doctest validate the example output as well. E.g.:

Suggested change
client2.sys.create_namespace(path="app1")
create_resp = client2.sys.create_namespace(path="app1")
print('ID for created "app1" namespace: %s' % create_resp['data']['id'])
Example output:
.. testoutput:: sys_namespace
ID for created "app1" namespace: ...

(Ellipses / ... are treated as a wildcard)

The nice thing about including output in a testoutput directive is it helps ensure the examples are kept up to date with different Python and Vault versions if things change down the line.

Not suggesting changing this set of documentation to use that directive is a requirement or anything, just saying :)

This comment has been minimized.

Copy link
@drewmullen

drewmullen Jul 17, 2019

Author Contributor

yeah good point! the test is basically written so i think it makes sense to include the validation step! i was confused by it because, as a user, its just documentation so seeing JUST testoutput isnt helpful lol

@jeffwecan jeffwecan changed the title Namespace docs and delete function Add delete_namespace Method and Establish Namespace Documentation Jul 16, 2019

@drewmullen drewmullen force-pushed the drewmullen:namespace-docs-and-delete branch from a4e394f to 6ce243c Jul 17, 2019

@jeffwecan
Copy link
Collaborator

left a comment

:shipit:

@jeffwecan jeffwecan merged commit 175d079 into hvac:develop Jul 18, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.