Skip to content
This repository has been archived by the owner on Jun 5, 2018. It is now read-only.

Host entity names inconsistent between Satellite and satellite-populate #83

Open
chbrown13 opened this issue Aug 4, 2017 · 2 comments

Comments

@chbrown13
Copy link
Contributor

chbrown13 commented Aug 4, 2017

  • satellite-populate version: 0.1.3
  • Python version: 2.7.13
  • Operating System: Fedora 25

Description

Satellite automatically modifies the name of Host entities which causes problems for searching and performing actions for satellite-populate. Satellite automatically stores host names and appends a domain but the satellite-populate registry still refers to the object by the original name.

Example:

  • satellite-populate original name
vars:
  host_name: Update Host
# Create...
  • Satellite name
updatehost.8redwimjy5
  • Result
2017-08-04 14:59:03 - satellite_populate.base - INFO - DELETE: executing...
2017-08-04 14:59:03 - nailgun.client - DEBUG - Making HTTP GET request to https://hp-dl380gen9-01.khw.lab.eng.bos.redhat.com/api/v2/hosts with options {'verify': False, 'data': '{"search": "name=\\"Update Host\\"", "name": "Update Host"}', 'auth': ('admin', 'changeme'), 'headers': {'content-type': 'application/json'}}, no params and no data.
2017-08-04 14:59:03 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): hp-dl380gen9-01.khw.lab.eng.bos.redhat.com
2017-08-04 14:59:03 - urllib3.connectionpool - DEBUG - https://hp-dl380gen9-01.khw.lab.eng.bos.redhat.com:443 "GET /api/v2/hosts HTTP/1.1" 200 135
2017-08-04 14:59:03 - nailgun.client - DEBUG - Received HTTP 200 response: {
  "total": 4,
  "subtotal": 0,
  "page": 1,
  "per_page": 20,
  "search": "name=\"Update Host\"",
  "sort": {
    "by": null,
    "order": null
  },
  "results": []
}

2017-08-04 14:59:03 - satellite_populate.base - INFO - search: Host {'query': {'search': 'name="Update Host"'}} returned empty result
2017-08-04 14:59:03 - satellite_populate.base - ERROR - populate: delete: Cannot find entity {'action': 'delete', 'search_query': {'name': {'from_registry': 'reg_host.name'}}, 'model': 'Host', 'log_message': u'executing...'}
Traceback (most recent call last):
  File "/opt/virtual_env/satellite-populate/bin/satellite-populate", line 11, in <module>
    load_entry_point('satellite-populate', 'console_scripts', 'satellite-populate')()
  File "/opt/virtual_env/satellite-populate/lib/python2.7/site-packages/click-6.7-py2.7.egg/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/opt/virtual_env/satellite-populate/lib/python2.7/site-packages/click-6.7-py2.7.egg/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/opt/virtual_env/satellite-populate/lib/python2.7/site-packages/click-6.7-py2.7.egg/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/virtual_env/satellite-populate/lib/python2.7/site-packages/click-6.7-py2.7.egg/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/chris/Documents/satellite-populate/satellite_populate/commands.py", line 160, in main
    hostname, username, password, report, enable_output)
  File "/home/chris/Documents/satellite-populate/satellite_populate/commands.py", line 47, in execute_populate
    enable_output=enable_output
  File "/home/chris/Documents/satellite-populate/satellite_populate/main.py", line 62, in populate
    populator.execute()
  File "/home/chris/Documents/satellite-populate/satellite_populate/base.py", line 180, in execute
    entity_data, action_data, search, action
  File "/home/chris/Documents/satellite-populate/satellite_populate/api.py", line 39, in populate
    rendered_action_data, action_data, search, model, silent_errors
  File "/home/chris/Documents/satellite-populate/satellite_populate/api.py", line 114, in action_delete
    raise RuntimeError("delete: Cannot find entity")
RuntimeError: delete: Cannot find entity

@chbrown13 chbrown13 changed the title Host entity names inconsistent in Satellite and registry Host entity names inconsistent between Satellite and satellite-populate Aug 4, 2017
@chbrown13 chbrown13 added the bug label Aug 4, 2017
@rochacbruno
Copy link
Contributor

That is new to me, I did not know satellite changed the names. So in populate the search should be done by other atributes. This will be very hard to fix.

@chbrown13
Copy link
Contributor Author

Agreed, I also had to set _force_raw to True in constants.py because searching Host entities was running into an issue returning all hosts instead of the one specified, same as #66. So couldn't search with other attributes.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants