Skip to content

Commit

Permalink
Host ENC information
Browse files Browse the repository at this point in the history
  • Loading branch information
ldjebran committed Nov 14, 2017
1 parent 1a42807 commit 0ee20ba
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
17 changes: 17 additions & 0 deletions nailgun/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -3234,6 +3234,22 @@ def create(self, create_missing=None):
id=self.create_json(create_missing)['id'],
).read()

def enc(self, synchronous=True, **kwargs):
"""Return external node classifier (ENC) information
:param synchronous: What should happen if the server returns an HTTP
202 (accepted) status code? Wait for the task to complete if
``True``. Immediately return the server's response otherwise.
:param kwargs: Arguments to pass to requests.
:returns: The server's response, with all content decoded.
:raises: ``requests.exceptions.HTTPError`` If the server responds with
an HTTP 4XX or 5XX message.
"""
kwargs = kwargs.copy() # shadow the passed-in kwargs
kwargs.update(self._server_config.get_client_kwargs())
response = client.get(self.path('enc'), **kwargs)
return _handle_response(response, self._server_config, synchronous)

def errata(self, synchronous=True, **kwargs):
"""List errata available for the host
Expand Down Expand Up @@ -3415,6 +3431,7 @@ def path(self, which=None):
"""
if which in (
'enc',
'errata',
'errata/apply',
'facts',
Expand Down
2 changes: 2 additions & 0 deletions tests/test_entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ def test_id_and_which(self):
(entities.ContentView, 'publish'),
(entities.ContentViewVersion, 'promote'),
(entities.Environment, 'smart_class_parameters'),
(entities.Host, 'enc'),
(entities.Host, 'errata'),
(entities.Host, 'errata/apply'),
(entities.Host, 'puppetclass_ids'),
Expand Down Expand Up @@ -1672,6 +1673,7 @@ def setUpClass(cls):
'get'
),
(entities.Host(**generic).add_puppetclass, 'post'),
(entities.Host(**generic).enc, 'get'),
(entities.Host(**generic).errata, 'get'),
(entities.Host(**generic).errata_apply, 'put'),
(entities.Host(**generic).get_facts, 'get'),
Expand Down

0 comments on commit 0ee20ba

Please sign in to comment.