SatelliteQE / satellite-populate

This new module adds tools and commands to populate and validate entities in the system based in YAML file.
Other
8 stars 10 forks source link

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

Open chbrown13 opened 7 years ago

chbrown13 commented 7 years ago

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:

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 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

rochacbruno commented 7 years ago

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 commented 7 years ago

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.