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 content related helpers for Repository entity. #327

Merged
merged 1 commit into from
Oct 25, 2016
Merged

Add content related helpers for Repository entity. #327

merged 1 commit into from
Oct 25, 2016

Conversation

svtkachenko
Copy link
Contributor

repo = entities.Repository(product=product,content_type=REPO_TYPE['puppet']).create()
repo.upload_content(files={'content': handle})
repo.list_puppet_modules()
2016-10-20 17:24:45 - nailgun.client - DEBUG - Making HTTP GET request to https://example.com/katello/api/v2/repositories/28/puppet_modules with options {'verify': False, 'auth': ('admin', 'changeme'), 'headers': {'content-type': 'application/json'}} and no data.
2016-10-20 17:24:46 - nailgun.client - DEBUG - Received HTTP 200 response: {"total":1,"subtotal":1,"page":1,"per_page":20,"error":null,"search":null,"sort":{"by":null,"order":null},"results":[{"id":1,"uuid":"10bd97ab-932e-475d-bd1d-899285406c4e","name":"ntp","version":"3.2.1","author":"puppetlabs","summary":"NTP Module"}]}
module_id = repo.list_puppet_modules()['results'][-1]['id'] 
repo.remove_content(data={'ids': [module.id]})
2016-10-20 17:31:16 - nailgun.client - DEBUG - Making HTTP GET request to https://example.com/foreman_tasks/api/tasks/2fd14434-03a2-45fd-80bf-14db342824fa with options {'verify': False, 'auth': ('admin', 'changeme'), 'headers': {'content-type': 'application/json'}} and no data.
2016-10-20 17:31:17 - nailgun.client - DEBUG - Received HTTP 200 response: {"id":"2fd14434-03a2-45fd-80bf-14db342824fa","label":"Actions::Katello::Repository::RemoveContent","pending":false,"username":"admin","started_at":"2016-10-20 14:31:13 UTC","ended_at":"2016-10-20 14:31:16 UTC","state":"stopped","result":"success","progress":1.0,"input":{"repository":{"id":28,"name":"BnIHyOB","label":"BnIHyOB"},"product":{"id":89,"name":"jPNEZKSO","label":"jPNEZKSO","cp_id":"1476971127968"},"provider":{"id":117,"name":"Anonymous"},"organization":{"id":81,"name":"oUBvGf","label":"oUBvGf"},"repository_id":28,"user_id":3,"current_user_id":3},"output":{"task_id":"0dd185f1-b1b9-4e80-8969-a0be55fcb704"},"humanized":{"action":"Remove Content","input":[["repository",{"text":"repository 'BnIHyOB'","link":null}],["product",{"text":"product 'jPNEZKSO'","link":"#/products/89/info"}],["organization",{"text":"organization 'oUBvGf'","link":"/organizations/81/edit"}]],"output":"{\"task_id\"=>\"0dd185f1-b1b9-4e80-8969-a0be55fcb704\"}\n","errors":[]},"cli_example":null}

@coveralls
Copy link

coveralls commented Oct 20, 2016

Coverage Status

Coverage increased (+0.01%) to 98.544% when pulling 3b062d1 on svtkachenko:repo_helpers into 40ee56f on SatelliteQE:master.

Copy link
Contributor

@abalakh abalakh left a comment

Choose a reason for hiding this comment

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

ACK

@coveralls
Copy link

coveralls commented Oct 21, 2016

Coverage Status

Coverage increased (+0.01%) to 98.544% when pulling 18e10d1 on svtkachenko:repo_helpers into 40ee56f on SatelliteQE:master.

@coveralls
Copy link

coveralls commented Oct 21, 2016

Coverage Status

Coverage increased (+0.01%) to 98.544% when pulling eb472bb on svtkachenko:repo_helpers into 40ee56f on SatelliteQE:master.

Copy link
Contributor

@elyezer elyezer left a comment

Choose a reason for hiding this comment

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

I left some comments related to the definition we had in terms of naming helper methods, please take a look before merging this.

response = client.put(self.path('remove_content'), **kwargs)
return _handle_response(response, self._server_config, synchronous)

def list_puppet_modules(self, synchronous=True, **kwargs):
Copy link
Contributor

Choose a reason for hiding this comment

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

As far as I remember the helper names are after the API path. Shouldn't this be named puppet_modules instead since the path is puppet_modules and not list_puppet_modules?

Copy link
Contributor

Choose a reason for hiding this comment

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

Correct. Went through existing helpers and 99% of them proves your point. We have few helpers which were added recently and are not following this rule, so i filled #328 to fix this.

response = client.get(self.path('puppet_modules'), **kwargs)
return _handle_response(response, self._server_config, synchronous)

def list_packages(self, synchronous=True, **kwargs):
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here s/list_packages/packages?

@svtkachenko
Copy link
Contributor Author

Updated methods names.

@coveralls
Copy link

coveralls commented Oct 24, 2016

Coverage Status

Coverage increased (+0.01%) to 98.544% when pulling 440f07a on svtkachenko:repo_helpers into 40ee56f on SatelliteQE:master.

@elyezer
Copy link
Contributor

elyezer commented Oct 25, 2016

ACK

@abalakh abalakh merged commit 272ff30 into SatelliteQE:master Oct 25, 2016
@abalakh abalakh removed the review label Oct 25, 2016
elyezer added a commit to elyezer/nailgun that referenced this pull request Mar 6, 2017
Shortlog of commits since last release:

    Andrii Balakhtar (4):
          Fix read() of hostgroup without content_source, lce or cv for 6.1
          Increase timeout for manifest delete/refresh (SatelliteQE#359)
          Provide default name length & type for ComputeResource entities (SatelliteQE#369)
          Implemented Interface entity with all its fields and basic operations (SatelliteQE#373)

    Djebran Lezzoum (1):
          Merge pull request SatelliteQE#380 from svtkachenko/ct_update_payload

    Elyézer Rezende (1):
          Update travis config

    Oleksandr Shtaier (8):
          Merge pull request SatelliteQE#341 from sghai/update-test
          Merge pull request SatelliteQE#342 from renzon/332
          Merge pull request SatelliteQE#344 from elyezer/update-travis
          Merge pull request SatelliteQE#352 from svtkachenko/sv_payload
          Merge pull request SatelliteQE#345 from abalakh/fix_hg_61_workaround
          Merge pull request SatelliteQE#366 from svtkachenko/update_template_kind
          Merge pull request SatelliteQE#361 from svtkachenko/update_sv
          Merge pull request SatelliteQE#383 from svtkachenko/63_image

    Renzo Nuccitelli (3):
          Added json method to Entity (SatelliteQE#326)
          Merge pull request SatelliteQE#347 from svtkachenko/add_image
          Implemented Entity __eq__ method comparing all fields (SatelliteQE#350)

    Stanislav Tkachenko (10):
          Add content related helpers for Repository entity. (SatelliteQE#327)
          Add Create and Delete mixins to Smart Proxy (SatelliteQE#343)
          Add mixins to Image
          Override create_payload and upload_payload for SmartVariable.
          Update Host.puppet_class field name. (SatelliteQE#346)
          Removed overriden read method for Smart Variable
          Update TemplateKind entity
          Add ProvisioningTemplate. (SatelliteQE#365)
          Fix update_payload method for ConfigTemplate/ProvisioningTemplate
          [6.2.z] Update Image and Host entities (SatelliteQE#356)

    oshtaier (2):
          Add UpdateMixin for CV Filter Rules entity
          Add host count field to CV entity

    renzon (5):
          Fixed ConfigTemplate create and update with TemplateCombination
          ListFiled handled on _payload
          api fixed and methods GET and DELETED added for TemplateCombination
          api fixed and methods GET and DELETED added for TemplateCombination
          api fixed and methods GET and DELETED added for TemplateCombination

    sghai (5):
          Updated discovery_rule entity with org & location (SatelliteQE#320)
          Added a new field root_pass to hostgroup entity (SatelliteQE#336)
          Added unit test for root_pass from hostgroup entity
          Merge pull request SatelliteQE#338 from oshtaier/cvf_update_mixin
          Merge pull request SatelliteQE#340 from oshtaier/cv_field
@svtkachenko svtkachenko deleted the repo_helpers branch August 22, 2017 14:52
lpramuk pushed a commit to lpramuk/nailgun that referenced this pull request Sep 26, 2023
lpramuk pushed a commit to lpramuk/nailgun that referenced this pull request Sep 26, 2023
Shortlog of commits since last release:

    Andrii Balakhtar (4):
          Fix read() of hostgroup without content_source, lce or cv for 6.1
          Increase timeout for manifest delete/refresh (SatelliteQE#359)
          Provide default name length & type for ComputeResource entities (SatelliteQE#369)
          Implemented Interface entity with all its fields and basic operations (SatelliteQE#373)

    Djebran Lezzoum (1):
          Merge pull request SatelliteQE#380 from svtkachenko/ct_update_payload

    Elyézer Rezende (1):
          Update travis config

    Oleksandr Shtaier (8):
          Merge pull request SatelliteQE#341 from sghai/update-test
          Merge pull request SatelliteQE#342 from renzon/332
          Merge pull request SatelliteQE#344 from elyezer/update-travis
          Merge pull request SatelliteQE#352 from svtkachenko/sv_payload
          Merge pull request SatelliteQE#345 from abalakh/fix_hg_61_workaround
          Merge pull request SatelliteQE#366 from svtkachenko/update_template_kind
          Merge pull request SatelliteQE#361 from svtkachenko/update_sv
          Merge pull request SatelliteQE#383 from svtkachenko/63_image

    Renzo Nuccitelli (3):
          Added json method to Entity (SatelliteQE#326)
          Merge pull request SatelliteQE#347 from svtkachenko/add_image
          Implemented Entity __eq__ method comparing all fields (SatelliteQE#350)

    Stanislav Tkachenko (10):
          Add content related helpers for Repository entity. (SatelliteQE#327)
          Add Create and Delete mixins to Smart Proxy (SatelliteQE#343)
          Add mixins to Image
          Override create_payload and upload_payload for SmartVariable.
          Update Host.puppet_class field name. (SatelliteQE#346)
          Removed overriden read method for Smart Variable
          Update TemplateKind entity
          Add ProvisioningTemplate. (SatelliteQE#365)
          Fix update_payload method for ConfigTemplate/ProvisioningTemplate
          [6.2.z] Update Image and Host entities (SatelliteQE#356)

    oshtaier (2):
          Add UpdateMixin for CV Filter Rules entity
          Add host count field to CV entity

    renzon (5):
          Fixed ConfigTemplate create and update with TemplateCombination
          ListFiled handled on _payload
          api fixed and methods GET and DELETED added for TemplateCombination
          api fixed and methods GET and DELETED added for TemplateCombination
          api fixed and methods GET and DELETED added for TemplateCombination

    sghai (5):
          Updated discovery_rule entity with org & location (SatelliteQE#320)
          Added a new field root_pass to hostgroup entity (SatelliteQE#336)
          Added unit test for root_pass from hostgroup entity
          Merge pull request SatelliteQE#338 from oshtaier/cvf_update_mixin
          Merge pull request SatelliteQE#340 from oshtaier/cv_field
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.

None yet

4 participants