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

Provide default name length & type for ComputeResource entities #369

Merged
merged 1 commit into from
Jan 30, 2017

Conversation

abalakh
Copy link
Contributor

@abalakh abalakh commented Jan 30, 2017

Default name length for AbstractComputeResource (and subentities like LibvirtComputeResource) was not set, which can lead to entities with one character in name being created, which in rare cases (like latest automation run 😄 ) can attempt to create 2 entities with the same name (the longer name is, the less is the chance of the same name generation).
Also removing cjk from the tuple of acceptable string types as it creates issues with readability and basically increases efforts for debugging.
This PR should have been implemented as a part of #290

@abalakh abalakh self-assigned this Jan 30, 2017
@abalakh abalakh added the review label Jan 30, 2017
@abalakh
Copy link
Contributor Author

abalakh commented Jan 30, 2017

Not sure if some kind of test results are needed here, but just in case:

>>> entities.LibvirtComputeResource().create(True)
2017-01-30 17:47:48 - nailgun.client - DEBUG - Making HTTP POST request to https://example.redhat.com/api/v2/compute_resources with options {'verify': False, 'auth': ('admin', 'changeme'), 'headers': {'content-type': 'application/json'}} and data {"compute_resource": {"name": "bFfrTiRPtz", "provider": "Libvirt", "url": "http://XVZAvDyqHY.info", "display_type": "vnc"}}.
2017-01-30 17:47:50 - nailgun.client - DEBUG - Received HTTP 201 response: {"description":null,"url":"http://XVZAvDyqHY.info","created_at":"2017-01-30 15:47:51 UTC","updated_at":"2017-01-30 15:47:51 UTC","id":2,"name":"bFfrTiRPtz","provider":"Libvirt","provider_friendly_name":"Libvirt","display_type":"vnc","set_console_password":true,"images":[],"compute_attributes":[],"locations":[],"organizations":[]}
nailgun.entities.LibvirtComputeResource(nailgun.config.ServerConfig(url='https://example.redhat.com', verify=False, auth=('admin', 'changeme')), description=None, url=u'http://XVZAvDyqHY.info', provider_friendly_name=u'Libvirt', location=[], provider=u'Libvirt', organization=[], display_type=u'vnc', id=2, set_console_password=True, name=u'bFfrTiRPtz')
>>> entities.DockerComputeResource().create(True)
2017-01-30 17:48:16 - nailgun.client - DEBUG - Making HTTP POST request to https://example.redhat.com/api/v2/compute_resources with options {'verify': False, 'auth': ('admin', 'changeme'), 'headers': {'content-type': 'application/json'}} and data {"compute_resource": {"provider": "Docker", "url": "unix:///var/run/docker.sock", "name": "eKGnAatz"}}.
2017-01-30 17:48:17 - nailgun.client - DEBUG - Received HTTP 201 response: {"description":null,"url":"unix:///var/run/docker.sock","created_at":"2017-01-30 15:48:17 UTC","updated_at":"2017-01-30 15:48:17 UTC","id":3,"name":"eKGnAatz","provider":"Docker","provider_friendly_name":"Docker","user":null,"images":[],"compute_attributes":[],"locations":[],"organizations":[]}
2017-01-30 17:48:17 - nailgun.client - DEBUG - Making HTTP GET request to https://example.redhat.com/api/v2/compute_resources/3 with options {'verify': False, 'auth': ('admin', 'changeme'), 'headers': {'content-type': 'application/json'}} and no data.
2017-01-30 17:48:17 - nailgun.client - DEBUG - Received HTTP 200 response: {"description":null,"url":"unix:///var/run/docker.sock","created_at":"2017-01-30 15:48:17 UTC","updated_at":"2017-01-30 15:48:17 UTC","id":3,"name":"eKGnAatz","provider":"Docker","provider_friendly_name":"Docker","user":null,"images":[],"compute_attributes":[],"locations":[],"organizations":[]}
2017-01-30 17:48:17 - nailgun.client - DEBUG - Making HTTP PUT request to https://example.redhat.com/api/v2/compute_resources/3 with options {'verify': False, 'auth': ('admin', 'changeme'), 'headers': {'content-type': 'application/json'}} and data {}.
2017-01-30 17:48:18 - nailgun.client - DEBUG - Received HTTP 200 response: {"description":null,"url":"unix:///var/run/docker.sock","created_at":"2017-01-30 15:48:17 UTC","updated_at":"2017-01-30 15:48:19 UTC","id":3,"name":"eKGnAatz","provider":"Docker","provider_friendly_name":"Docker","user":null,"images":[],"compute_attributes":[],"locations":[],"organizations":[]}
nailgun.entities.DockerComputeResource(nailgun.config.ServerConfig(url='https://example.redhat.com', verify=False, auth=('admin', 'changeme')), description=None, url=u'unix:///var/run/docker.sock', location=[], email=None, provider_friendly_name=u'Docker', user=None, provider=u'Docker', organization=[], id=3, name=u'eKGnAatz')

@abalakh abalakh requested a review from rplevka January 30, 2017 16:07
@coveralls
Copy link

coveralls commented Jan 30, 2017

Coverage Status

Coverage remained the same at 98.583% when pulling b464ee6 on abalakh:def_name_abst_cr into 26c0239 on SatelliteQE:master.

@rplevka
Copy link
Member

rplevka commented Jan 30, 2017

ACK - requires cherry-picks

Copy link
Contributor

@rochacbruno rochacbruno left a comment

Choose a reason for hiding this comment

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

ACK

pending cherry picks

@rochacbruno rochacbruno merged commit 602a4a5 into SatelliteQE:master Jan 30, 2017
@abalakh abalakh deleted the def_name_abst_cr branch January 30, 2017 16:40
@abalakh
Copy link
Contributor Author

abalakh commented Jan 30, 2017

Part of #368

rplevka added a commit that referenced this pull request Jan 30, 2017
[6.2.z] [Cherry-pick] Provide default name length & type for ComputeResource entities (#369)
rplevka added a commit that referenced this pull request Jan 30, 2017
[6.1.z] [Cherry-pick] Provide default name length & type for ComputeResource entities (#369)
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
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