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

api fixed and methods GET and DELETED added for TemplateCombination #342

Merged
merged 3 commits into from
Dec 16, 2016

Conversation

renzon
Copy link
Contributor

@renzon renzon commented Dec 16, 2016

fixes #332

Results:

>>> from nailgun.config import ServerConfig
>>> from nailgun.entities import HostGroup, Environment, ConfigTemplate, TemplateCombination
>>> cfg = ServerConfig('https://foo.bar', 
...                    auth=('baz', '****'), verify=False)
>>> def creat_ent(cls, **kwargs):
...     return cls(cfg, **kwargs)
>>> hostgroup=creat_ent(HostGroup, name='group').create()
>>> env=creat_ent(Environment, name='env').create()
>>> config_template=creat_ent(
...     ConfigTemplate,snippet=False,name='comb',template='cat', template_kind=8,
...     template_combinations=[{'hostgroup_id': hostgroup.id, 'environment_id': env.id}]
... ).create()
>>> combination_dct=config_template.template_combinations[0]
>>> combination_dct
{u'environment_id': 6, u'provisioning_template_name': u'comb', u'environment_name': u'env', u'hostgroup_id': 5, u'config_template_name': u'comb', u'hostgroup_name': u'group', u'provisioning_template_id': 110, u'id': 5, u'config_template_id': 110}
>>> combination=creat_ent(TemplateCombination, id=combination_dct['id'])
>>> combination=combination.read()  # Get working
>>> combination
nailgun.entities.TemplateCombination(nailgun.config.ServerConfig(url='https://foo.bar', verify=False, auth=('baz', '****')), environment=nailgun.entities.Environment(nailgun.config.ServerConfig(url='https://foo.bar', verify=False, auth=('baz', '****')), id=6), config_template=nailgun.entities.ConfigTemplate(nailgun.config.ServerConfig(url='https://foo.bar', verify=False, auth=('baz', '****')), id=110), id=5, hostgroup=nailgun.entities.HostGroup(nailgun.config.ServerConfig(url='https://foo.bar', verify=False, auth=('baz', '****')), id=5))
>>> combination.delete() # Delete working
{u'environment_id': 6, u'provisioning_template_id': 110, u'created_at': u'2016-12-16T12:21:02.687Z', u'updated_at': u'2016-12-16T12:21:02.687Z', u'hostgroup_id': 5, u'id': 5}

@renzon renzon self-assigned this Dec 16, 2016
@renzon
Copy link
Contributor Author

renzon commented Dec 16, 2016

OBS: New version of nailgun must be publish after this merge. After publication SatelliteQE/robottelo#4099 can be reviewed and merged as well.

@coveralls
Copy link

coveralls commented Dec 16, 2016

Coverage Status

Coverage remained the same at 98.578% when pulling 7802ba6 on renzon:332 into b5fd3d1 on SatelliteQE:master.

@@ -5298,7 +5300,8 @@ def read(self, entity=None, attrs=None, ignore=None):
return super(System, self).read(entity, attrs, ignore)


class TemplateCombination(Entity):
class TemplateCombination(Entity, EntityReadMixin, EntityDeleteMixin,
Copy link
Contributor

Choose a reason for hiding this comment

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

class TemplateCombination(
        Entity,
        EntityDeleteMixin 
        EntityReadMixin,
        EntityUpdateMixin):

@oshtaier
Copy link
Contributor

Yeah, only get and delete methods are present using that base URL

@oshtaier
Copy link
Contributor

Please, use direct nailgun calls for testing and providing results. Robotello is redundant layer in that case

@coveralls
Copy link

coveralls commented Dec 16, 2016

Coverage Status

Coverage remained the same at 98.578% when pulling 62099f8 on renzon:332 into b5fd3d1 on SatelliteQE:master.

@coveralls
Copy link

coveralls commented Dec 16, 2016

Coverage Status

Coverage remained the same at 98.578% when pulling 62099f8 on renzon:332 into b5fd3d1 on SatelliteQE:master.

@coveralls
Copy link

coveralls commented Dec 16, 2016

Coverage Status

Coverage remained the same at 98.578% when pulling 62099f8 on renzon:332 into b5fd3d1 on SatelliteQE:master.

@renzon
Copy link
Contributor Author

renzon commented Dec 16, 2016

@oshtaier normally I would use directly nailgun. But robottelo test was already done. In fact it was the reason I found those bugs on nailgun. So I took the lazy path and just posted the tests using it =P. But if you think directly call is really needed, I can make it ;)

@renzon
Copy link
Contributor Author

renzon commented Dec 16, 2016

I don't know why is travis failing on docs creation only on Python 3.3.

@renzon renzon added review and removed in progress labels Dec 16, 2016
@svtkachenko
Copy link
Contributor

@renzon If I remember correctly it's because latest sphinx requires python 3.4+

@@ -5298,7 +5300,7 @@ def read(self, entity=None, attrs=None, ignore=None):
return super(System, self).read(entity, attrs, ignore)


class TemplateCombination(Entity):
class TemplateCombination(Entity, EntityReadMixin, EntityDeleteMixin):
Copy link
Contributor

Choose a reason for hiding this comment

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

I think usually we put mixins in alphabetical order.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed ;)

Copy link
Contributor

Choose a reason for hiding this comment

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

already wrote about that above:)

@coveralls
Copy link

coveralls commented Dec 16, 2016

Coverage Status

Coverage remained the same at 98.578% when pulling 0620990 on renzon:332 into b5fd3d1 on SatelliteQE:master.

@oshtaier
Copy link
Contributor

Direct call will instantly show whether every mixin works and you really can perform all actions that you like

@oshtaier
Copy link
Contributor

oshtaier commented Dec 16, 2016

About travis - yes, we had discussion with @omaciel and @rochacbruno about that, but we didn't have any final decision. We have to whether remove 3.3 verification at all or make sphinx static for version when it worked for 3.3

@@ -5298,7 +5300,7 @@ def read(self, entity=None, attrs=None, ignore=None):
return super(System, self).read(entity, attrs, ignore)


class TemplateCombination(Entity):
class TemplateCombination(EntityDeleteMixin, EntityReadMixin, Entity):
Copy link
Contributor

Choose a reason for hiding this comment

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

TemplateCombination(Entity, EntityDeleteMixin, EntityReadMixin):

@renzon
Copy link
Contributor Author

renzon commented Dec 16, 2016

@oshtaier I edited #342 (comment) to have nailgun session

@renzon
Copy link
Contributor Author

renzon commented Dec 16, 2016

@oshtaier @svtkachenko Entities Mixings order fixed

@coveralls
Copy link

coveralls commented Dec 16, 2016

Coverage Status

Coverage remained the same at 98.578% when pulling 2f46d4d on renzon:332 into b5fd3d1 on SatelliteQE:master.

Copy link
Contributor

@svtkachenko svtkachenko left a comment

Choose a reason for hiding this comment

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

ACK

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.

LGTM, ACK

@renzon
Copy link
Contributor Author

renzon commented Dec 16, 2016

@oshtaier please check the nailgun session and changes, merging if you think it is ok. Thanks.

@oshtaier oshtaier merged commit 78d6657 into SatelliteQE:master Dec 16, 2016
@oshtaier oshtaier removed the review label Dec 16, 2016
@renzon renzon deleted the 332 branch December 16, 2016 14:11
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
renzon pushed a commit that referenced this pull request Mar 14, 2017
api fixed and methods GET and DELETED added for TemplateCombination
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.

Make TemplateCombination CRUDable
5 participants