I'm trying to create a Capsule in Satellite populate but since the nailgun entity does not extend EntityCreateMixin then the object doesn't have a create method.
2017-07-19 13:43:45 - satellite_populate.base - INFO - search: Capsule {'query': {'search': 'url="satellite.populate.test.com",name="cap"'}} returned empty result
2017-07-19 13:43:45 - satellite_populate.base - ERROR - populate: 'Capsule' object has no attribute 'create' {'log_message': u'test_capsule', 'model': 'Capsule', 'register': 'test_capsule', 'data': {'url': '{{ url }}', 'name': '{{ cap_name }}'}}
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 161, 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 70, in action_create
result = model(rendered_action_data).create()
AttributeError: 'Capsule' object has no attribute 'create'
Description
I'm trying to create a Capsule in Satellite populate but since the nailgun entity does not extend EntityCreateMixin then the object doesn't have a create method.
What I Did
test_capsule.yaml
'capsule': {'_force_raw': True}
to RAW_SEARCH_RULES in constants.py to search by name2017-07-19 13:43:45 - satellite_populate.base - INFO - Starting in populate mode 2017-07-19 13:43:45 - satellite_populate.base - INFO - CREATE: test_capsule 2017-07-19 13:43:45 - satellite_populate.base - DEBUG - {'data': {'url': u'satellite.populate.test.com', 'name': u'cap'}, 'options': {'query': {'search': 'url="satellite.populate.test.com",name="cap"'}}, 'searchable': True} 2017-07-19 13:43:45 - nailgun.client - DEBUG - Making HTTP GET request to https://hp-sl4545g7-01.khw.lab.eng.bos.redhat.com/katello/api/capsules with options {'verify': False, 'data': '{"url": "satellite.populate.test.com", "search": "url=\"satellite.populate.test.com\",name=\"cap\"", "name": "cap"}', 'auth': ('admin', 'changeme'), 'headers': {'content-type': 'application/json'}}, no params and no data. 2017-07-19 13:43:45 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): hp-sl4545g7-01.khw.lab.eng.bos.redhat.com 2017-07-19 13:43:45 - urllib3.connectionpool - DEBUG - https://hp-sl4545g7-01.khw.lab.eng.bos.redhat.com:443 "GET /katello/api/capsules HTTP/1.1" 200 148 2017-07-19 13:43:45 - nailgun.client - DEBUG - Received HTTP 200 response: { "total": 1, "subtotal": 0, "page": 1, "per_page": 20, "search": "url=\"satellite.populate.test.com\",name=\"cap\"", "sort": { "by": null, "order": null }, "results": [] }
2017-07-19 13:43:45 - satellite_populate.base - INFO - search: Capsule {'query': {'search': 'url="satellite.populate.test.com",name="cap"'}} returned empty result 2017-07-19 13:43:45 - satellite_populate.base - ERROR - populate: 'Capsule' object has no attribute 'create' {'log_message': u'test_capsule', 'model': 'Capsule', 'register': 'test_capsule', 'data': {'url': '{{ url }}', 'name': '{{ cap_name }}'}} 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 161, 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 70, in action_create
result = model(rendered_action_data).create()
AttributeError: 'Capsule' object has no attribute 'create'