satelliteqe / satellite-populate Goto Github PK
View Code? Open in Web Editor NEWThis new module adds tools and commands to populate and validate entities in the system based in YAML file.
License: Other
This new module adds tools and commands to populate and validate entities in the system based in YAML file.
License: Other
I created an Interface entity but cannot delete it because when an interface it created, it requires a Host entity parameter. However sometimes satellite-populate actions only uses the entity_id or other specified attributes which causes an error.
EDIT: Also applies to other actions other than delete
[delete] ( (https://github.com/SatelliteQE/satellite-populate/blob/master/satellite_populate/api.py#L120)
[search] (https://github.com/SatelliteQE/satellite-populate/blob/master/satellite_populate/base.py#L595)
TypeError: A value must be provided for the ___ field.
[root@localhost satellite]# satellite-populate test_interface.yaml -h hp-dl380gen9-01.khw.lab.eng.bos.redhat.com --no-output -v
...
2017-08-04 15:32:26 - satellite_populate.base - INFO - DELETE: executing...
2017-08-04 15:32:26 - nailgun.client - DEBUG - Making HTTP GET request to https://hp-dl380gen9-01.khw.lab.eng.bos.redhat.com/api/v2/hosts/51/interfaces with options {'verify': False, 'data': '{"host_id": 51, "name": "Interface"}', 'auth': ('admin', 'changeme'), 'headers': {'content-type': 'application/json'}}, no params and no data.
2017-08-04 15:32:26 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): hp-dl380gen9-01.khw.lab.eng.bos.redhat.com
2017-08-04 15:32:26 - urllib3.connectionpool - DEBUG - https://hp-dl380gen9-01.khw.lab.eng.bos.redhat.com:443 "GET /api/v2/hosts/51/interfaces HTTP/1.1" 200 288
2017-08-04 15:32:26 - nailgun.client - DEBUG - Received HTTP 200 response: {
"total": 1,
"subtotal": 1,
"page": 1,
"per_page": 20,
"search": null,
"sort": {
"by": null,
"order": null
},
"results": [{"subnet_id":null,"subnet_name":null,"subnet6_id":null,"subnet6_name":null,"domain_id":61,"domain_name":"mcjrdftg1w","created_at":"2017-08-04 19:32:25 UTC","updated_at":"2017-08-04 19:32:25 UTC","managed":true,"identifier":null,"id":66,"name":"host.mcjrdftg1w","ip":null,"ip6":null,"mac":"ca:fe:4b:d0:96:85","primary":true,"provision":true,"type":"interface","virtual":false}]
}
2017-08-04 15:32:26 - satellite_populate.base - INFO - search: Interface {'host': 51, 'name': u'Interface'} found unique item
2017-08-04 15:32:26 - satellite_populate.base - ERROR - populate: A value must be provided for the "host" field. {'action': 'delete', 'search_query': {'host': {'from_registry': 'reg_host'}, 'name': '{{ name }}'}, 'model': 'Interface', '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 124, in action_delete
model(id=entity_id).delete()
File "/opt/virtual_env/satellite-populate/lib/python2.7/site-packages/nailgun/entities.py", line 3369, in __init__
_check_for_value('host', kwargs)
File "/opt/virtual_env/satellite-populate/lib/python2.7/site-packages/nailgun/entities.py", line 152, in _check_for_value
'A value must be provided for the "{0}" field.'.format(field_name)
TypeError: A value must be provided for the "host" field.
Hi, someone with admin rights please add webhook for rtd
http://docs.readthedocs.io/en/latest/webhooks.html
currently I am building docs manually
The BasePopulator class should be really base
most of the methods should be moved to APIPopulator
and a placeholder with NotImplementedError
should be left in base for required methods.
Having these files in a directory /data
Then a root file called main.yaml
# vars: implicit imported from vars.yaml
# implicit imported from config.yaml
# then merged with:
config:
username: admin
actions:
- include: organizations.yaml
- include: users.yaml
- action: other
...
...
then:
```bash
satellite-populate /data/
should start from main.yaml
inside /data/ folder
A config file to store properties and avoid always copying arguments such as -h and other configuration data. Similar to robotello.properties (https://github.com/SatelliteQE/robottelo/blob/master/robottelo.properties.sample)
Another setup that needs write access there :)
In some cases performing a search on entities fails because a boolean value True or False is converted to a string 'True' or 'False'
satellite-populate test_provision_template.yaml -h hp-bl465cgen8-01.rhts.eng.bos.redhat.com --no-output -v
...
2017-07-27 16:20:19 - satellite_populate.base - ERROR - populate: 400 Client Error: Bad Request for url: https://hp-bl465cgen8-01.rhts.eng.bos.redhat.com/api/v2/provisioning_templates {'log_message': u'test_prov_tmp', 'model': 'ProvisioningTemplate', 'register': 'test_prov_tmp', 'data': {'template_combinations': ['a', 'b', 'c'], 'snippet': True, 'locked': True, 'name': '{{ name }}', 'template': 'temp', 'audit_comment': 'comment'}}{
"error": {"message":"'snippet' should be one of 'true, false', but the query was 'True'","class":"ScopedSearch::QueryNotSupported"}
}
...
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 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 186, 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 95, in action_update
raise RuntimeError("update: Cannot find entity")
RuntimeError: update: Cannot find entity
Unable to create AuthSourceLDAP entities because they are not searchable
# satellite-populate test_authsourceLDAP.yaml -h hp-sl4545g7-01.khw.lab.eng.bos.redhat.com -v
2017-07-19 09:02:14 - satellite_populate.base - INFO - Starting in populate mode
2017-07-19 09:02:15 - satellite_populate.base - INFO - CREATE: test_auth
2017-07-19 09:02:15 - satellite_populate.base - DEBUG - {'data': {'host': u'satellite.populate.test.com', 'name': u'Authentication Source'}, 'options': {'query': {'search': 'host="satellite.populate.test.com",name="Authentication Source"'}}, 'searchable': False}
2017-07-19 09:02:15 - satellite_populate.base - ERROR - search: AuthSourceLDAP not searchable
2017-07-19 09:02:15 - satellite_populate.base - ERROR - populate: AuthSourceLDAP not searchable {'log_message': u'test_auth', 'model': 'AuthSourceLDAP', 'register': 'test_auth', 'data': {'host': '{{ host_name }}', 'name': '{{ auth_name }}'}}
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 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 58, in action_create
model, search, unique=True, silent_errors=silent_errors
File "/home/chris/Documents/satellite-populate/satellite_populate/base.py", line 595, in get_search_result
raise TypeError("{0} not searchable".format(model.__name__))
TypeError: AuthSourceLDAP not searchable
Additional actions are required to automate the following scenario in Satellite 6 with satellite-populate from @sthirugn:
enable rhel7server repo, enable satellite tools for rhel7 server, sync repos, create rhel7 content view, add these two repos, publish content view, create an activation key, add subscriptions, enable these synced repos
To accomplish this, actions for sync
, enable
, and publish
need to be created as well as possibly adding a Manifest or Manifest entity.
Hi ๐
This is my first visit to this fine repo, but it seems you have been working hard to keep all dependencies updated so far.
Once you have closed this issue, I'll create seperate pull requests for every update as soon as I find one.
That's it for now!
Happy merging! ๐ค
While trying to create an Architecture entity, I received the following error message: "RuntimeError: More than 1 item returned search is not unique". The new architecture was actually unique but all the existing architectures were returned from the search. I expected the new Architecture to be created and no values returned in the results.
# satellite-populate test_architecture.yaml -h hp-sl4545g7-01.khw.lab.eng.bos.redhat.com -v
2017-07-18 10:24:21 - satellite_populate.base - INFO - Starting in populate mode
2017-07-18 10:24:21 - satellite_populate.base - INFO - CREATE: default_arch
2017-07-18 10:24:21 - nailgun.client - DEBUG - Making HTTP GET request to https://hp-sl4545g7-01.khw.lab.eng.bos.redhat.com/api/v2/architectures with options {'verify': False, 'data': '{"name": "[\'x64-128\']"}', 'auth': ('admin', 'changeme'), 'headers': {'content-type': 'application/json'}} and no data.
2017-07-18 10:24:21 - requests.packages.urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): hp-sl4545g7-01.khw.lab.eng.bos.redhat.com
2017-07-18 10:24:22 - requests.packages.urllib3.connectionpool - DEBUG - https://hp-sl4545g7-01.khw.lab.eng.bos.redhat.com:443 "GET /api/v2/architectures HTTP/1.1" 200 181
2017-07-18 10:24:22 - nailgun.client - DEBUG - Received HTTP 200 response: {
"total": 2,
"subtotal": 2,
"page": 1,
"per_page": 20,
"search": null,
"sort": {
"by": null,
"order": null
},
"results": [{"created_at":"2017-07-17 16:35:36 UTC","updated_at":"2017-07-17 16:35:36 UTC","name":"x86_64","id":1},{"created_at":"2017-07-17 16:35:36 UTC","updated_at":"2017-07-17 16:35:36 UTC","name":"i386","id":2}]
}
2017-07-18 10:24:22 - satellite_populate.base - ERROR - search: Architecture {'name': u"['x64-128']"} is not unique
2017-07-18 10:24:22 - satellite_populate.base - DEBUG - [nailgun.entities.Architecture(id=1, name=u'x86_64'), nailgun.entities.Architecture(id=2, name=u'i386')]
2017-07-18 10:24:22 - satellite_populate.base - ERROR - populate: More than 1 item returned search is not unique {'log_message': u'default_arch', 'model': 'Architecture', 'register': 'default_arch', 'data': {'name': '{{ arch_name }}'}}
Traceback (most recent call last):
File "/usr/bin/satellite-populate", line 9, in <module>
load_entry_point('satellite-populate', 'console_scripts', 'satellite-populate')()
File "/usr/lib64/python2.7/site-packages/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/usr/lib64/python2.7/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/lib64/python2.7/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/lib64/python2.7/site-packages/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 58, in action_create
model, search, unique=True, silent_errors=silent_errors
File "/home/chris/Documents/satellite-populate/satellite_populate/base.py", line 619, in get_search_result
"More than 1 item returned "
RuntimeError: More than 1 item returned search is not unique
Example should be using https://github.com/SatelliteQE/robottelo/blob/master/robottelo/helpers.py#L87
example:
- action: register
log: Get current O.S version using a helper defined in robottelo
data:
os_version:
from_<eval|python|function|callable>: robottelo.helpers.get_os_version()
- model: Repository
data:
content_type: ostree
when: os_version > 6
Domain entities are unable to be deleted with satellite-populate and raise an error that the domain is being used by the satellite host.
(test_domain.yaml)[https://gist.github.com/chbrown13/3269d8f1a99c53314d6b54f1e61eeca0]
(satellite-populate) [root@localhost satellite]# satellite-populate test_domain.yaml --no-output
2017-08-15 15:14:02 - satellite_populate.base - INFO - Starting in populate mode
2017-08-15 15:14:02 - satellite_populate.base - INFO - CREATE: test_entity
2017-08-15 15:14:02 - nailgun.client - DEBUG - Making HTTP GET request to https://hp-xl420gen9-01.khw.lab.eng.bos.redhat.com/api/v2/domains with options {'verify': False, 'data': '{"fullname": "domain_name.example.com", "name": "domain_name"}', 'auth': ('admin', 'changeme'), 'headers': {'content-type': 'application/json'}}, no params and no data.
2017-08-15 15:14:02 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): hp-xl420gen9-01.khw.lab.eng.bos.redhat.com
2017-08-15 15:14:02 - urllib3.connectionpool - DEBUG - https://hp-xl420gen9-01.khw.lab.eng.bos.redhat.com:443 "GET /api/v2/domains HTTP/1.1" 200 223
2017-08-15 15:14:02 - nailgun.client - DEBUG - Received HTTP 200 response: {
"total": 1,
"subtotal": 1,
"page": 1,
"per_page": 20,
"search": null,
"sort": {
"by": null,
"order": null
},
"results": [{"fullname":"test.domain_name.example.com","created_at":"2017-08-15 14:56:33 UTC","updated_at":"2017-08-15 19:10:18 UTC","id":1,"name":"http://www.test_domain.com","dns_id":null,"dns":null}]
}
2017-08-15 15:14:02 - satellite_populate.base - INFO - search: Domain {'fullname': u'domain_name.example.com', 'name': u'domain_name'} found unique item
2017-08-15 15:14:02 - satellite_populate.base - INFO - create: Entity already exists: Domain 1
2017-08-15 15:14:02 - satellite_populate.base - INFO - registry: Domain:1 registered as test_entity
2017-08-15 15:14:02 - satellite_populate.base - INFO - UPDATE: test_entity
2017-08-15 15:14:02 - nailgun.client - DEBUG - Making HTTP GET request to https://hp-xl420gen9-01.khw.lab.eng.bos.redhat.com/api/v2/domains with options {'verify': False, 'data': '{"name": "domain_name"}', 'auth': ('admin', 'changeme'), 'headers': {'content-type': 'application/json'}}, no params and no data.
2017-08-15 15:14:02 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): hp-xl420gen9-01.khw.lab.eng.bos.redhat.com
2017-08-15 15:14:03 - urllib3.connectionpool - DEBUG - https://hp-xl420gen9-01.khw.lab.eng.bos.redhat.com:443 "GET /api/v2/domains HTTP/1.1" 200 223
2017-08-15 15:14:03 - nailgun.client - DEBUG - Received HTTP 200 response: {
"total": 1,
"subtotal": 1,
"page": 1,
"per_page": 20,
"search": null,
"sort": {
"by": null,
"order": null
},
"results": [{"fullname":"test.domain_name.example.com","created_at":"2017-08-15 14:56:33 UTC","updated_at":"2017-08-15 19:10:18 UTC","id":1,"name":"http://www.test_domain.com","dns_id":null,"dns":null}]
}
2017-08-15 15:14:03 - satellite_populate.base - INFO - search: Domain {'name': u'domain_name'} found unique item
2017-08-15 15:14:03 - nailgun.client - DEBUG - Making HTTP PUT request to https://hp-xl420gen9-01.khw.lab.eng.bos.redhat.com/api/v2/domains/1 with options {'verify': False, 'auth': ('admin', 'changeme'), 'headers': {'content-type': 'application/json'}}, no params and data {"domain": {"fullname": "test.domain_name.example.com"}}.
2017-08-15 15:14:03 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): hp-xl420gen9-01.khw.lab.eng.bos.redhat.com
2017-08-15 15:14:03 - urllib3.connectionpool - DEBUG - https://hp-xl420gen9-01.khw.lab.eng.bos.redhat.com:443 "PUT /api/v2/domains/1 HTTP/1.1" 200 312
2017-08-15 15:14:03 - nailgun.client - DEBUG - Received HTTP 200 response: {"fullname":"test.domain_name.example.com","created_at":"2017-08-15 14:56:33 UTC","updated_at":"2017-08-15 19:10:18 UTC","id":1,"name":"http://www.test_domain.com","dns_id":null,"dns":null,"subnets":[],"interfaces":[{"id":1,"name":"hp-xl420gen9-01.khw.lab.eng.bos.redhat.com","ip":"10.16.184.240","ip6":"2620:52:0:10bb:3a63:bbff:fe48:c40","mac":"38:63:bb:48:0c:40","identifier":"eno1","primary":true,"provision":true,"type":"interface"}],"parameters":[],"locations":[],"organizations":[]}
2017-08-15 15:14:03 - nailgun.client - DEBUG - Making HTTP GET request to https://hp-xl420gen9-01.khw.lab.eng.bos.redhat.com/api/v2/domains/1 with options {'verify': False, 'auth': ('admin', 'changeme'), 'headers': {'content-type': 'application/json'}}, no params and no data.
2017-08-15 15:14:03 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): hp-xl420gen9-01.khw.lab.eng.bos.redhat.com
2017-08-15 15:14:03 - urllib3.connectionpool - DEBUG - https://hp-xl420gen9-01.khw.lab.eng.bos.redhat.com:443 "GET /api/v2/domains/1 HTTP/1.1" 200 312
2017-08-15 15:14:03 - nailgun.client - DEBUG - Received HTTP 200 response: {"fullname":"test.domain_name.example.com","created_at":"2017-08-15 14:56:33 UTC","updated_at":"2017-08-15 19:10:18 UTC","id":1,"name":"http://www.test_domain.com","dns_id":null,"dns":null,"subnets":[],"interfaces":[{"id":1,"name":"hp-xl420gen9-01.khw.lab.eng.bos.redhat.com","ip":"10.16.184.240","ip6":"2620:52:0:10bb:3a63:bbff:fe48:c40","mac":"38:63:bb:48:0c:40","identifier":"eno1","primary":true,"provision":true,"type":"interface"}],"parameters":[],"locations":[],"organizations":[]}
2017-08-15 15:14:03 - satellite_populate.base - INFO - update: <class 'nailgun.entities.Domain'> 1
2017-08-15 15:14:03 - satellite_populate.base - INFO - registry: Domain:1 registered as test_entity
2017-08-15 15:14:03 - satellite_populate.base - INFO - ASSERTION: executing...
2017-08-15 15:14:03 - satellite_populate.base - INFO - assertion: test.domain_name.example.com is eq to test.domain_name.example.com
2017-08-15 15:14:03 - satellite_populate.base - INFO - DELETE: executing...
2017-08-15 15:14:03 - nailgun.client - DEBUG - Making HTTP GET request to https://hp-xl420gen9-01.khw.lab.eng.bos.redhat.com/api/v2/domains with options {'verify': False, 'data': '{"name": "domain_name"}', 'auth': ('admin', 'changeme'), 'headers': {'content-type': 'application/json'}}, no params and no data.
2017-08-15 15:14:03 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): hp-xl420gen9-01.khw.lab.eng.bos.redhat.com
2017-08-15 15:14:03 - urllib3.connectionpool - DEBUG - https://hp-xl420gen9-01.khw.lab.eng.bos.redhat.com:443 "GET /api/v2/domains HTTP/1.1" 200 223
2017-08-15 15:14:03 - nailgun.client - DEBUG - Received HTTP 200 response: {
"total": 1,
"subtotal": 1,
"page": 1,
"per_page": 20,
"search": null,
"sort": {
"by": null,
"order": null
},
"results": [{"fullname":"test.domain_name.example.com","created_at":"2017-08-15 14:56:33 UTC","updated_at":"2017-08-15 19:10:18 UTC","id":1,"name":"http://www.test_domain.com","dns_id":null,"dns":null}]
}
2017-08-15 15:14:03 - satellite_populate.base - INFO - search: Domain {'name': u'domain_name'} found unique item
2017-08-15 15:14:03 - nailgun.client - DEBUG - Making HTTP DELETE request to https://hp-xl420gen9-01.khw.lab.eng.bos.redhat.com/api/v2/domains/1 with options {'verify': False, 'auth': ('admin', 'changeme'), 'headers': {'content-type': 'application/json'}}, no params and no data.
2017-08-15 15:14:03 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): hp-xl420gen9-01.khw.lab.eng.bos.redhat.com
2017-08-15 15:14:03 - urllib3.connectionpool - DEBUG - https://hp-xl420gen9-01.khw.lab.eng.bos.redhat.com:443 "DELETE /api/v2/domains/1 HTTP/1.1" 422 None
2017-08-15 15:14:03 - nailgun.client - WARNING - Received HTTP 422 response: {
"error": {"id":1,"errors":{"base":["http://www.test_domain.com is used by hp-xl420gen9-01.khw.lab.eng.bos.redhat.com"]},"full_messages":["http://www.test_domain.com is used by hp-xl420gen9-01.khw.lab.eng.bos.redhat.com"]}
}
2017-08-15 15:14:03 - satellite_populate.base - ERROR - populate: 422 Client Error: Unprocessable Entity for url: https://hp-xl420gen9-01.khw.lab.eng.bos.redhat.com/api/v2/domains/1 {'action': 'delete', 'search_query': {'name': '{{ name }}'}, 'model': 'Domain', 'log_message': u'executing...'}{
"error": {"id":1,"errors":{"base":["http://www.test_domain.com is used by hp-xl420gen9-01.khw.lab.eng.bos.redhat.com"]},"full_messages":["http://www.test_domain.com is used by hp-xl420gen9-01.khw.lab.eng.bos.redhat.com"]}
}
2017-08-15 15:14:03 - satellite_populate.base - INFO - populate finished!
2017-08-15 15:14:03 - satellite_populate.base - INFO - 1 entities already existing in the system
2017-08-15 15:14:03 - satellite_populate.base - INFO - 0 entities were created in the system
2017-08-15 15:14:03 - satellite_populate.base - ERROR - populate: 422 Client Error: Unprocessable Entity for url: https://hp-xl420gen9-01.khw.lab.eng.bos.redhat.com/api/v2/domains/1 {'action': 'delete', 'search_query': {'name': '{{ name }}'}, 'model': 'Domain', 'log_message': u'executing...'}{
"error": {"id":1,"errors":{"base":["http://www.test_domain.com is used by hp-xl420gen9-01.khw.lab.eng.bos.redhat.com"]},"full_messages":["http://www.test_domain.com is used by hp-xl420gen9-01.khw.lab.eng.bos.redhat.com"]}
}
2017-08-15 15:14:03 - satellite_populate.base - ERROR - {'data': {'name': u'domain_name'}, 'options': {}, 'searchable': True}
Using the robottelo SSH helper or get example from PulpSmash
Implement the action:
- action: ssh
command: ls -la /tmp
register: tmp_ls_output
parse_as: json|csv|plain
auth:
user:
password:
key:
# omit to use from config
When provided in command line or YAML config.
it should be considered the nailgun version in https://github.com/SatelliteQE/satellite-populate/blob/master/satellite_populate/base.py#L842
the version
argument should be used. https://github.com/SatelliteQE/nailgun/blob/master/nailgun/config.py#L103
Any of you can help with this?
We need to run populate across different versions and nailgun has one branch/tag for each sat version.
initial idea is using
pip install satellite-populate[6.2]
and then defining that [6.2]
we are telling that nailgun requirement is that specific version.
but we have some issues to solve:
Add support for timers
Create more detailed tests and examples to ensure all the nailgun entities are supported.
when using decorator in another project e.g: robottelo the nailgun config is already set, so no need to define it again.
Make it lazy and not set if already set by robottelo.
Document each action and include all accepted variables and some examples.
When running satellite-populate, validation files are created and stored. If a user runs the program many times then the directory will become cluttered with a lot of validation .yaml files. Perhaps there's a way to delete them after a satellite-populate command finishes running.
- action: automation-tools
name: function_name
....
Then we can call existing automation tools functions inside the populate datafile
Several nailgun entities with the EntityCreateMixin, which provides the ability to create the entity, fail during the create action if they don't have the EntitySearchMixin because a search is executed during create.
Edit: This also affects update and delete
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 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 186, 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 58, in action_create
model, search, unique=True, silent_errors=silent_errors
File "/home/chris/Documents/satellite-populate/satellite_populate/base.py", line 602, in get_search_result
raise TypeError("{0} not searchable".format(model.__name__))
TypeError: ComputeProfile not searchable
ERROR: Permission to SatelliteQE/satellite-populate.git denied to rochacbruno.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
satellite-populate returns a weird SQL error when trying to create DockerHubContainer and DockerRegistryContainer entites with a DockerComputeResource. The DockerComputeResource was created successfully but creating the containers fails because an SQL query used to create them fails trying to search with the following error:
ERROR: argument of WHERE must be type boolean, not type integer\nLINE 1: SELECT "containers".* FROM "containers" WHERE (1) LIMIT 20 ...\n ^\n: SELECT "containers".* FROM "containers" WHERE (1) LIMIT 20 OFFSET 0"
***edit- Looks like just the id of the DockerComputeResource is passed into the WHERE clause instead of WHERE(id=1)
# satellite-populate test_docker_containers.yaml -h dell-pem630-01.rhts.eng.bos.redhat.com --no-output -v
(satellite-populate) [root@localhost satellite]# satellite-populate test_docker_containers.yaml -h dell-pem630-01.rhts.eng.bos.redhat.com --no-output -v
2017-07-28 13:09:43 - satellite_populate.base - INFO - Starting in populate mode
2017-07-28 13:09:43 - satellite_populate.base - INFO - CREATE: resource
2017-07-28 13:09:43 - satellite_populate.base - DEBUG - DEBUG
2017-07-28 13:09:43 - satellite_populate.base - DEBUG - {'name': u'docker_source', 'provider': 'Docker'}
2017-07-28 13:09:43 - satellite_populate.base - DEBUG - {'log_message': u'resource', 'model': 'DockerComputeResource', 'register': 'resource', 'data': {'name': '{{ resource_name }}', 'provider': 'Docker'}}
2017-07-28 13:09:43 - satellite_populate.base - DEBUG - {'data': {'name': u'docker_source', 'provider': 'Docker'}, 'options': {'query': {'search': 'name="docker_source"'}}, 'searchable': True}
2017-07-28 13:09:43 - satellite_populate.base - DEBUG - create
2017-07-28 13:09:43 - satellite_populate.base - DEBUG - END
2017-07-28 13:09:43 - satellite_populate.base - DEBUG - {'data': {'name': u'docker_source', 'provider': 'Docker'}, 'options': {'query': {'search': 'name="docker_source"'}}, 'searchable': True}
2017-07-28 13:09:43 - satellite_populate.base - DEBUG - False
2017-07-28 13:09:43 - nailgun.client - DEBUG - Making HTTP GET request to https://dell-pem630-01.rhts.eng.bos.redhat.com/api/v2/compute_resources with options {'verify': False, 'data': '{"search": "name=\\"docker_source\\"", "name": "docker_source", "provider": "Docker"}', 'auth': ('admin', 'changeme'), 'headers': {'content-type': 'application/json'}}, no params and no data.
2017-07-28 13:09:43 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): dell-pem630-01.rhts.eng.bos.redhat.com
2017-07-28 13:09:43 - urllib3.connectionpool - DEBUG - https://dell-pem630-01.rhts.eng.bos.redhat.com:443 "GET /api/v2/compute_resources HTTP/1.1" 200 131
2017-07-28 13:09:43 - nailgun.client - DEBUG - Received HTTP 200 response: {
"total": 0,
"subtotal": 0,
"page": 1,
"per_page": 20,
"search": "name=\"docker_source\"",
"sort": {
"by": null,
"order": null
},
"results": []
}
2017-07-28 13:09:43 - satellite_populate.base - INFO - search: DockerComputeResource {'query': {'search': 'name="docker_source"'}} returned empty result
2017-07-28 13:09:43 - satellite_populate.base - DEBUG - ['__class__', '__delattr__', '__dict__', '__doc__', '__eq__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'compare', 'create', 'create_json', 'create_missing', 'create_payload', 'create_raw', 'delete', 'delete_raw', 'get_fields', 'get_values', 'path', 'read', 'read_json', 'read_raw', 'search', 'search_filter', 'search_json', 'search_normalize', 'search_payload', 'search_raw', 'to_json', 'to_json_dict', 'update', 'update_json', 'update_payload', 'update_raw']
2017-07-28 13:09:43 - satellite_populate.base - DEBUG - {'name': u'docker_source', 'provider': 'Docker'}
2017-07-28 13:09:43 - nailgun.client - DEBUG - Making HTTP POST request to https://dell-pem630-01.rhts.eng.bos.redhat.com/api/v2/compute_resources with options {'verify': False, 'auth': ('admin', 'changeme'), 'headers': {'content-type': 'application/json'}}, no params and data {"compute_resource": {"provider": "Docker", "url": "http://TgZqvsqCZQ.com", "name": "docker_source"}}.
2017-07-28 13:09:43 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): dell-pem630-01.rhts.eng.bos.redhat.com
2017-07-28 13:09:43 - urllib3.connectionpool - DEBUG - https://dell-pem630-01.rhts.eng.bos.redhat.com:443 "POST /api/v2/compute_resources HTTP/1.1" 201 None
2017-07-28 13:09:43 - nailgun.client - DEBUG - Received HTTP 201 response: {"description":null,"url":"http://TgZqvsqCZQ.com","created_at":"2017-07-28 17:09:43 UTC","updated_at":"2017-07-28 17:09:43 UTC","id":1,"name":"docker_source","provider":"Docker","provider_friendly_name":"Docker","user":null,"images":[],"compute_attributes":[],"locations":[],"organizations":[]}
2017-07-28 13:09:43 - nailgun.client - DEBUG - Making HTTP GET request to https://dell-pem630-01.rhts.eng.bos.redhat.com/api/v2/compute_resources/1 with options {'verify': False, 'auth': ('admin', 'changeme'), 'headers': {'content-type': 'application/json'}}, no params and no data.
2017-07-28 13:09:43 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): dell-pem630-01.rhts.eng.bos.redhat.com
2017-07-28 13:09:44 - urllib3.connectionpool - DEBUG - https://dell-pem630-01.rhts.eng.bos.redhat.com:443 "GET /api/v2/compute_resources/1 HTTP/1.1" 200 203
2017-07-28 13:09:44 - nailgun.client - DEBUG - Received HTTP 200 response: {"description":null,"url":"http://TgZqvsqCZQ.com","created_at":"2017-07-28 17:09:43 UTC","updated_at":"2017-07-28 17:09:43 UTC","id":1,"name":"docker_source","provider":"Docker","provider_friendly_name":"Docker","user":null,"images":[],"compute_attributes":[],"locations":[],"organizations":[]}
2017-07-28 13:09:44 - nailgun.client - DEBUG - Making HTTP PUT request to https://dell-pem630-01.rhts.eng.bos.redhat.com/api/v2/compute_resources/1 with options {'verify': False, 'auth': ('admin', 'changeme'), 'headers': {'content-type': 'application/json'}}, no params and data {}.
2017-07-28 13:09:44 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): dell-pem630-01.rhts.eng.bos.redhat.com
2017-07-28 13:09:44 - urllib3.connectionpool - DEBUG - https://dell-pem630-01.rhts.eng.bos.redhat.com:443 "PUT /api/v2/compute_resources/1 HTTP/1.1" 200 203
2017-07-28 13:09:44 - nailgun.client - DEBUG - Received HTTP 200 response: {"description":null,"url":"http://TgZqvsqCZQ.com","created_at":"2017-07-28 17:09:43 UTC","updated_at":"2017-07-28 17:09:43 UTC","id":1,"name":"docker_source","provider":"Docker","provider_friendly_name":"Docker","user":null,"images":[],"compute_attributes":[],"locations":[],"organizations":[]}
2017-07-28 13:09:44 - satellite_populate.base - INFO - create: Entity created: DockerComputeResource 1
2017-07-28 13:09:44 - satellite_populate.base - INFO - registry: DockerComputeResource:1 registered as resource
2017-07-28 13:09:44 - satellite_populate.base - INFO - CREATE: test_hub
2017-07-28 13:09:44 - satellite_populate.base - DEBUG - DEBUG
2017-07-28 13:09:44 - satellite_populate.base - DEBUG - {'repository_name': 'test', 'tag': 'satellite', 'name': u'docker hub', 'compute_resource': nailgun.entities.DockerComputeResource(description=None, url=u'http://TgZqvsqCZQ.com', location=[], email=None, provider_friendly_name=u'Docker', user=None, provider=u'Docker', organization=[], id=1, name=u'docker_source')}
2017-07-28 13:09:44 - satellite_populate.base - DEBUG - {'log_message': u'test_hub', 'model': 'DockerHubContainer', 'register': 'test_hub', 'data': {'repository_name': 'test', 'tag': 'satellite', 'name': '{{ hub_name }}', 'compute_resource': {'from_registry': 'resource'}}}
2017-07-28 13:09:44 - satellite_populate.base - DEBUG - {'data': {'repository_name': 'test', 'tag': 'satellite', 'name': u'docker hub', 'compute_resource': nailgun.entities.DockerComputeResource(description=None, url=u'http://TgZqvsqCZQ.com', location=[], email=None, provider_friendly_name=u'Docker', user=None, provider=u'Docker', organization=[], id=1, name=u'docker_source')}, 'options': {}, 'searchable': True}
2017-07-28 13:09:44 - satellite_populate.base - DEBUG - create
2017-07-28 13:09:44 - satellite_populate.base - DEBUG - END
2017-07-28 13:09:44 - satellite_populate.base - DEBUG - {'data': {'repository_name': 'test', 'tag': 'satellite', 'name': u'docker hub', 'compute_resource': nailgun.entities.DockerComputeResource(description=None, url=u'http://TgZqvsqCZQ.com', location=[], email=None, provider_friendly_name=u'Docker', user=None, provider=u'Docker', organization=[], id=1, name=u'docker_source')}, 'options': {}, 'searchable': True}
2017-07-28 13:09:44 - satellite_populate.base - DEBUG - False
2017-07-28 13:09:44 - nailgun.client - DEBUG - Making HTTP GET request to https://dell-pem630-01.rhts.eng.bos.redhat.com/docker/api/v2/containers with options {'verify': False, 'data': '{"repository_name": "test", "tag": "satellite", "name": "docker hub", "compute_resource_id": 1}', 'auth': ('admin', 'changeme'), 'headers': {'content-type': 'application/json'}}, no params and no data.
2017-07-28 13:09:44 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): dell-pem630-01.rhts.eng.bos.redhat.com
2017-07-28 13:09:44 - urllib3.connectionpool - DEBUG - https://dell-pem630-01.rhts.eng.bos.redhat.com:443 "GET /docker/api/v2/containers HTTP/1.1" 500 None
2017-07-28 13:09:44 - nailgun.client - WARNING - Received HTTP 500 response: {
"error": {"message":"PG::Error: ERROR: argument of WHERE must be type boolean, not type integer\nLINE 1: SELECT \"containers\".* FROM \"containers\" WHERE (1) LIMIT 20 ...\n ^\n: SELECT \"containers\".* FROM \"containers\" WHERE (1) LIMIT 20 OFFSET 0"}
}
2017-07-28 13:09:44 - satellite_populate.base - ERROR - populate: 500 Server Error: Internal Server Error for url: https://dell-pem630-01.rhts.eng.bos.redhat.com/docker/api/v2/containers {'log_message': u'test_hub', 'model': 'DockerHubContainer', 'register': 'test_hub', 'data': {'repository_name': 'test', 'tag': 'satellite', 'name': '{{ hub_name }}', 'compute_resource': {'from_registry': 'resource'}}}{
"error": {"message":"PG::Error: ERROR: argument of WHERE must be type boolean, not type integer\nLINE 1: SELECT \"containers\".* FROM \"containers\" WHERE (1) LIMIT 20 ...\n ^\n: SELECT \"containers\".* FROM \"containers\" WHERE (1) LIMIT 20 OFFSET 0"}
}
2017-07-28 13:09:44 - satellite_populate.base - INFO - CREATE: test_registry
2017-07-28 13:09:44 - satellite_populate.base - DEBUG - DEBUG
2017-07-28 13:09:44 - satellite_populate.base - DEBUG - {'repository_name': 'test', 'tag': 'satellite', 'name': u'docker registry', 'compute_resource': nailgun.entities.DockerComputeResource(description=None, url=u'http://TgZqvsqCZQ.com', location=[], email=None, provider_friendly_name=u'Docker', user=None, provider=u'Docker', organization=[], id=1, name=u'docker_source')}
2017-07-28 13:09:44 - satellite_populate.base - DEBUG - {'log_message': u'test_registry', 'model': 'DockerRegistryContainer', 'register': 'test_registry', 'data': {'repository_name': 'test', 'tag': 'satellite', 'name': '{{ registry_name }}', 'compute_resource': {'from_registry': 'resource'}}}
2017-07-28 13:09:44 - satellite_populate.base - DEBUG - {'data': {'repository_name': 'test', 'tag': 'satellite', 'name': u'docker registry', 'compute_resource': nailgun.entities.DockerComputeResource(description=None, url=u'http://TgZqvsqCZQ.com', location=[], email=None, provider_friendly_name=u'Docker', user=None, provider=u'Docker', organization=[], id=1, name=u'docker_source')}, 'options': {}, 'searchable': True}
2017-07-28 13:09:44 - satellite_populate.base - DEBUG - create
2017-07-28 13:09:44 - satellite_populate.base - DEBUG - END
2017-07-28 13:09:44 - satellite_populate.base - DEBUG - {'data': {'repository_name': 'test', 'tag': 'satellite', 'name': u'docker registry', 'compute_resource': nailgun.entities.DockerComputeResource(description=None, url=u'http://TgZqvsqCZQ.com', location=[], email=None, provider_friendly_name=u'Docker', user=None, provider=u'Docker', organization=[], id=1, name=u'docker_source')}, 'options': {}, 'searchable': True}
2017-07-28 13:09:44 - satellite_populate.base - DEBUG - False
2017-07-28 13:09:44 - nailgun.client - DEBUG - Making HTTP GET request to https://dell-pem630-01.rhts.eng.bos.redhat.com/docker/api/v2/containers with options {'verify': False, 'data': '{"repository_name": "test", "tag": "satellite", "name": "docker registry", "compute_resource_id": 1}', 'auth': ('admin', 'changeme'), 'headers': {'content-type': 'application/json'}}, no params and no data.
2017-07-28 13:09:44 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): dell-pem630-01.rhts.eng.bos.redhat.com
2017-07-28 13:09:44 - urllib3.connectionpool - DEBUG - https://dell-pem630-01.rhts.eng.bos.redhat.com:443 "GET /docker/api/v2/containers HTTP/1.1" 500 None
2017-07-28 13:09:44 - nailgun.client - WARNING - Received HTTP 500 response: {
"error": {"message":"PG::Error: ERROR: argument of WHERE must be type boolean, not type integer\nLINE 1: SELECT \"containers\".* FROM \"containers\" WHERE (1) LIMIT 20 ...\n ^\n: SELECT \"containers\".* FROM \"containers\" WHERE (1) LIMIT 20 OFFSET 0"}
}
2017-07-28 13:09:44 - satellite_populate.base - ERROR - populate: 500 Server Error: Internal Server Error for url: https://dell-pem630-01.rhts.eng.bos.redhat.com/docker/api/v2/containers {'log_message': u'test_registry', 'model': 'DockerRegistryContainer', 'register': 'test_registry', 'data': {'repository_name': 'test', 'tag': 'satellite', 'name': '{{ registry_name }}', 'compute_resource': {'from_registry': 'resource'}}}{
"error": {"message":"PG::Error: ERROR: argument of WHERE must be type boolean, not type integer\nLINE 1: SELECT \"containers\".* FROM \"containers\" WHERE (1) LIMIT 20 ...\n ^\n: SELECT \"containers\".* FROM \"containers\" WHERE (1) LIMIT 20 OFFSET 0"}
}
2017-07-28 13:09:44 - satellite_populate.base - INFO - DELETE: executing...
2017-07-28 13:09:44 - satellite_populate.base - DEBUG - DEBUG
2017-07-28 13:09:44 - satellite_populate.base - DEBUG - {'_values': None}
2017-07-28 13:09:44 - satellite_populate.base - DEBUG - {'action': 'delete', 'search_query': {'name': '{{ resource_name }}'}, 'model': 'DockerComputeResource', 'log_message': u'executing...'}
2017-07-28 13:09:44 - satellite_populate.base - DEBUG - {'data': {'name': u'docker_source'}, 'options': {'query': {'search': 'name="docker_source"'}}, 'searchable': True}
2017-07-28 13:09:44 - satellite_populate.base - DEBUG - delete
2017-07-28 13:09:44 - satellite_populate.base - DEBUG - END
2017-07-28 13:09:44 - satellite_populate.base - DEBUG - {'data': {'name': u'docker_source'}, 'options': {'query': {'search': 'name="docker_source"'}}, 'searchable': True}
2017-07-28 13:09:44 - satellite_populate.base - DEBUG - False
2017-07-28 13:09:44 - nailgun.client - DEBUG - Making HTTP GET request to https://dell-pem630-01.rhts.eng.bos.redhat.com/api/v2/compute_resources with options {'verify': False, 'data': '{"search": "name=\\"docker_source\\"", "name": "docker_source"}', 'auth': ('admin', 'changeme'), 'headers': {'content-type': 'application/json'}}, no params and no data.
2017-07-28 13:09:44 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): dell-pem630-01.rhts.eng.bos.redhat.com
2017-07-28 13:09:44 - urllib3.connectionpool - DEBUG - https://dell-pem630-01.rhts.eng.bos.redhat.com:443 "GET /api/v2/compute_resources HTTP/1.1" 200 249
2017-07-28 13:09:44 - nailgun.client - DEBUG - Received HTTP 200 response: {
"total": 1,
"subtotal": 1,
"page": 1,
"per_page": 20,
"search": "name=\"docker_source\"",
"sort": {
"by": null,
"order": null
},
"results": [{"description":null,"url":"http://TgZqvsqCZQ.com","created_at":"2017-07-28 17:09:43 UTC","updated_at":"2017-07-28 17:09:43 UTC","id":1,"name":"docker_source","provider":"Docker","provider_friendly_name":"Docker","user":null}]
}
2017-07-28 13:09:44 - satellite_populate.base - INFO - search: DockerComputeResource {'query': {'search': 'name="docker_source"'}} found unique item
2017-07-28 13:09:44 - nailgun.client - DEBUG - Making HTTP DELETE request to https://dell-pem630-01.rhts.eng.bos.redhat.com/api/v2/compute_resources/1 with options {'verify': False, 'auth': ('admin', 'changeme'), 'headers': {'content-type': 'application/json'}}, no params and no data.
2017-07-28 13:09:44 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): dell-pem630-01.rhts.eng.bos.redhat.com
2017-07-28 13:09:45 - urllib3.connectionpool - DEBUG - https://dell-pem630-01.rhts.eng.bos.redhat.com:443 "DELETE /api/v2/compute_resources/1 HTTP/1.1" 200 179
2017-07-28 13:09:45 - nailgun.client - DEBUG - Received HTTP 200 response: {"id":1,"name":"docker_source","description":null,"url":"http://TgZqvsqCZQ.com","user":null,"password":null,"uuid":null,"created_at":"2017-07-28T17:09:43.757Z","updated_at":"2017-07-28T17:09:43.757Z","attrs":{},"email":null,"caching_enabled":true}
2017-07-28 13:09:45 - satellite_populate.base - INFO - delete: <class 'nailgun.entities.DockerComputeResource'> 1
2017-07-28 13:09:45 - satellite_populate.base - INFO - populate finished!
2017-07-28 13:09:45 - satellite_populate.base - INFO - 0 entities already existing in the system
2017-07-28 13:09:45 - satellite_populate.base - INFO - 1 entities were created in the system
2017-07-28 13:09:45 - satellite_populate.base - ERROR - populate: 500 Server Error: Internal Server Error for url: https://dell-pem630-01.rhts.eng.bos.redhat.com/docker/api/v2/containers {'log_message': u'test_hub', 'model': 'DockerHubContainer', 'register': 'test_hub', 'data': {'repository_name': 'test', 'tag': 'satellite', 'name': '{{ hub_name }}', 'compute_resource': {'from_registry': 'resource'}}}{
"error": {"message":"PG::Error: ERROR: argument of WHERE must be type boolean, not type integer\nLINE 1: SELECT \"containers\".* FROM \"containers\" WHERE (1) LIMIT 20 ...\n ^\n: SELECT \"containers\".* FROM \"containers\" WHERE (1) LIMIT 20 OFFSET 0"}
}
2017-07-28 13:09:45 - satellite_populate.base - ERROR - {'data': {'repository_name': 'test', 'tag': 'satellite', 'name': u'docker hub', 'compute_resource': nailgun.entities.DockerComputeResource(description=None, url=u'http://TgZqvsqCZQ.com', location=[], email=None, provider_friendly_name=u'Docker', user=None, provider=u'Docker', organization=[], id=1, name=u'docker_source')}, 'options': {}, 'searchable': True}
2017-07-28 13:09:45 - satellite_populate.base - ERROR - populate: 500 Server Error: Internal Server Error for url: https://dell-pem630-01.rhts.eng.bos.redhat.com/docker/api/v2/containers {'log_message': u'test_registry', 'model': 'DockerRegistryContainer', 'register': 'test_registry', 'data': {'repository_name': 'test', 'tag': 'satellite', 'name': '{{ registry_name }}', 'compute_resource': {'from_registry': 'resource'}}}{
"error": {"message":"PG::Error: ERROR: argument of WHERE must be type boolean, not type integer\nLINE 1: SELECT \"containers\".* FROM \"containers\" WHERE (1) LIMIT 20 ...\n ^\n: SELECT \"containers\".* FROM \"containers\" WHERE (1) LIMIT 20 OFFSET 0"}
}
2017-07-28 13:09:45 - satellite_populate.base - ERROR - {'data': {'repository_name': 'test', 'tag': 'satellite', 'name': u'docker registry', 'compute_resource': nailgun.entities.DockerComputeResource(description=None, url=u'http://TgZqvsqCZQ.com', location=[], email=None, provider_friendly_name=u'Docker', user=None, provider=u'Docker', organization=[], id=1, name=u'docker_source')}, 'options': {}, 'searchable': True}
Trying to create a Bookmark entity with satellite-populate but creation always fails.
# satellite-populate test_bookmark.yaml -h hp-sl4545g7-01.khw.lab.eng.bos.redhat.com -v
2017-07-19 13:14:09 - satellite_populate.base - INFO - Starting in populate mode
2017-07-19 13:14:09 - satellite_populate.base - INFO - CREATE: test_bookmark
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 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 168, in execute
rendered_action_data, action_data
File "/home/chris/Documents/satellite-populate/satellite_populate/base.py", line 504, in build_search
model = getattr(entities, model_name)
AttributeError: 'module' object has no attribute 'Boookmark'
So what we need to do is to include a new command in the tool
i.e: "satellite-populate generate -h http://fqdn.com -u admin -p changeme" -o new_file.yaml
Then a new YAML file is generated and saved.
To implement that command we have 2 options, and I don't know yet which one is the best.
OPTIONS:
Use existing export tool, maybe "hammer -csv" or other option, and then parse that data to generate the YAML output.
Use API or HAMMER to export every possible entity, this would demand us to have a list of all possible entities
and then we can call every API endpoint (or hammer command) doing a list
or search
and with data data we can
generate the YAML data file.
- action: name
...
retry:
times: 5
sleep: 30
if the above action fails for any reason, retry it 5 more times with sleep interval of 30
When trying to create an AbstractComputeResource with certain EC2 provider types (EC2, VMware, GCE, Openstack, Ovirt, Rackspace), satellite-populate fails because they require additional information such as a username, email, password, etc. that can't be blank. However the missing values can't be added to the yaml file because satellite-populate still fails since they aren't valid parameters for the entity.
test_abstractcomputeresource_gce.yaml
test_abstractcomputeresource_gce2.yaml
[root@localhost satellite]# satellite-populate abstractcomputeresource.yaml --no-output
2017-08-15 14:22:41 - satellite_populate.base - INFO - Starting in populate mode
2017-08-15 14:22:41 - satellite_populate.base - INFO - CREATE: test_entity
2017-08-15 14:22:41 - nailgun.client - DEBUG - Making HTTP GET request to https://hp-xl420gen9-01.khw.lab.eng.bos.redhat.com/api/v2/compute_resources with options {'verify': False, 'data': '{"provider": "GCE", "description": "{ desc }", "name": "{ name }"}', 'auth': ('admin', 'changeme'), 'headers': {'content-type': 'application/json'}} and no data.
2017-08-15 14:22:41 - requests.packages.urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): hp-xl420gen9-01.khw.lab.eng.bos.redhat.com
2017-08-15 14:22:42 - requests.packages.urllib3.connectionpool - DEBUG - https://hp-xl420gen9-01.khw.lab.eng.bos.redhat.com:443 "GET /api/v2/compute_resources HTTP/1.1" 200 111
2017-08-15 14:22:42 - nailgun.client - DEBUG - Received HTTP 200 response: {
"total": 0,
"subtotal": 0,
"page": 1,
"per_page": 20,
"search": null,
"sort": {
"by": null,
"order": null
},
"results": []
}
2017-08-15 14:22:42 - satellite_populate.base - INFO - search: AbstractComputeResource {'provider': 'GCE', 'description': '{ desc }', 'name': '{ name }'} returned empty result
2017-08-15 14:22:42 - nailgun.client - DEBUG - Making HTTP POST request to https://hp-xl420gen9-01.khw.lab.eng.bos.redhat.com/api/v2/compute_resources with options {'verify': False, 'auth': ('admin', 'changeme'), 'headers': {'content-type': 'application/json'}} and data {"compute_resource": {"name": "{ name }", "provider": "GCE", "url": "ftp://vfoFfgYQru.biz", "description": "{ desc }"}}.
2017-08-15 14:22:42 - requests.packages.urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): hp-xl420gen9-01.khw.lab.eng.bos.redhat.com
2017-08-15 14:22:42 - requests.packages.urllib3.connectionpool - DEBUG - https://hp-xl420gen9-01.khw.lab.eng.bos.redhat.com:443 "POST /api/v2/compute_resources HTTP/1.1" 422 None
2017-08-15 14:22:42 - nailgun.client - WARNING - Received HTTP 422 response: {
"error": {"id":null,"errors":{"key_path":["can't be blank"],"project":["can't be blank"],"email":["can't be blank"]},"full_messages":["Key path can't be blank","Project can't be blank","Email can't be blank"]}
}
2017-08-15 14:22:42 - satellite_populate.base - ERROR - populate: 422 Client Error: Unprocessable Entity for url: https://hp-xl420gen9-01.khw.lab.eng.bos.redhat.com/api/v2/compute_resources {'log_message': u'test_entity', 'model': 'AbstractComputeResource', 'register': 'test_entity', 'data': {'description': '{ desc }', 'name': '{ name }', 'provider': 'GCE'}}{
"error": {"id":null,"errors":{"key_path":["can't be blank"],"project":["can't be blank"],"email":["can't be blank"]},"full_messages":["Key path can't be blank","Project can't be blank","Email can't be blank"]}
}
2017-08-15 14:22:42 - satellite_populate.base - INFO - UPDATE: test_entity
2017-08-15 14:22:42 - nailgun.client - DEBUG - Making HTTP GET request to https://hp-xl420gen9-01.khw.lab.eng.bos.redhat.com/api/v2/compute_resources with options {'verify': False, 'data': '{"name": "{ entity_name }"}', 'auth': ('admin', 'changeme'), 'headers': {'content-type': 'application/json'}} and no data.
2017-08-15 14:22:42 - requests.packages.urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): hp-xl420gen9-01.khw.lab.eng.bos.redhat.com
2017-08-15 14:22:42 - requests.packages.urllib3.connectionpool - DEBUG - https://hp-xl420gen9-01.khw.lab.eng.bos.redhat.com:443 "GET /api/v2/compute_resources HTTP/1.1" 200 111
2017-08-15 14:22:42 - nailgun.client - DEBUG - Received HTTP 200 response: {
"total": 0,
"subtotal": 0,
"page": 1,
"per_page": 20,
"search": null,
"sort": {
"by": null,
"order": null
},
"results": []
}
2017-08-15 14:22:42 - satellite_populate.base - INFO - search: AbstractComputeResource {'name': '{ entity_name }'} returned empty result
2017-08-15 14:22:42 - satellite_populate.base - ERROR - populate: update: Cannot find entity {'search_query': {'name': '{ entity_name }'}, 'register': 'test_entity', 'action': 'update', 'log_message': u'test_entity', 'model': 'AbstractComputeResource', 'data': {'description': '{ update_desc }'}}
Traceback (most recent call last):
File "/usr/bin/satellite-populate", line 9, in <module>
load_entry_point('satellite-populate==0.1.3', 'console_scripts', 'satellite-populate')()
File "/usr/lib64/python2.7/site-packages/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/usr/lib64/python2.7/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/lib64/python2.7/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/lib64/python2.7/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/satellite_populate/commands.py", line 161, in main
hostname, username, password, report, enable_output)
File "/usr/lib/python2.7/site-packages/satellite_populate/commands.py", line 47, in execute_populate
enable_output=enable_output
File "/usr/lib/python2.7/site-packages/satellite_populate/main.py", line 62, in populate
populator.execute()
File "/usr/lib/python2.7/site-packages/satellite_populate/base.py", line 180, in execute
entity_data, action_data, search, action
File "/usr/lib/python2.7/site-packages/satellite_populate/api.py", line 39, in populate
rendered_action_data, action_data, search, model, silent_errors
File "/usr/lib/python2.7/site-packages/satellite_populate/api.py", line 90, in action_update
raise RuntimeError("update: Cannot find entity")
RuntimeError: update: Cannot find entity
---------------------Added missing values--------------------------------------------------------------------------------
[root@localhost satellite]# satellite-populate abstractcomputeresource2.yaml --no-output
2017-08-15 14:24:49 - satellite_populate.base - INFO - Starting in populate mode
2017-08-15 14:24:49 - satellite_populate.base - INFO - CREATE: test_entity
2017-08-15 14:24:49 - satellite_populate.base - ERROR - populate: Valid fields are ['provider_friendly_name', 'url', 'name', 'location', 'provider', 'organization', 'id', 'description'], but received ['description', 'project', 'key_path', 'provider', 'email', 'name'] instead. {'log_message': u'test_entity', 'model': 'AbstractComputeResource', 'register': 'test_entity', 'data': {'project': 'satellite', 'name': '{ name }', 'provider': 'GCE', 'description': '{ desc }', 'email': '[email protected]', 'key_path': '/home'}}
Traceback (most recent call last):
File "/usr/bin/satellite-populate", line 9, in <module>
load_entry_point('satellite-populate==0.1.3', 'console_scripts', 'satellite-populate')()
File "/usr/lib64/python2.7/site-packages/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/usr/lib64/python2.7/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/lib64/python2.7/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/lib64/python2.7/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/satellite_populate/commands.py", line 161, in main
hostname, username, password, report, enable_output)
File "/usr/lib/python2.7/site-packages/satellite_populate/commands.py", line 47, in execute_populate
enable_output=enable_output
File "/usr/lib/python2.7/site-packages/satellite_populate/main.py", line 62, in populate
populator.execute()
File "/usr/lib/python2.7/site-packages/satellite_populate/base.py", line 180, in execute
entity_data, action_data, search, action
File "/usr/lib/python2.7/site-packages/satellite_populate/api.py", line 39, in populate
rendered_action_data, action_data, search, model, silent_errors
File "/usr/lib/python2.7/site-packages/satellite_populate/api.py", line 58, in action_create
model, search, unique=True, silent_errors=silent_errors
File "/usr/lib/python2.7/site-packages/satellite_populate/base.py", line 595, in get_search_result
result = model(**search['data']).search(**search['options'])
File "/usr/lib/python2.7/site-packages/nailgun/entities.py", line 750, in __init__
super(AbstractComputeResource, self).__init__(server_config, **kwargs)
File "/usr/lib/python2.7/site-packages/nailgun/entity_mixins.py", line 399, in __init__
.format(self._fields.keys(), kwargs.keys())
nailgun.entity_mixins.NoSuchFieldError: Valid fields are ['provider_friendly_name', 'url', 'name', 'location', 'provider', 'organization', 'id', 'description'], but received ['description', 'project', 'key_path', 'provider', 'email', 'name'] instead.
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:
vars:
host_name: Update Host
# Create...
updatehost.8redwimjy5
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
According to SatelliteQE/nailgun#363 this entity like Organization should always be searched using raw_query
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.
'capsule': {'_force_raw': True}
to RAW_SEARCH_RULES in constants.py to search by name# satellite-populate test_capsule.yaml -h hp-sl4545g7-01.khw.lab.eng.bos.redhat.com -v
2017-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 <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 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'
the context arg of the decorator is too ambiguous, it can have the sense whether to use context as True bool value or used as context name string value to be injected as arg in the called function.
def populate_with(data, context=None, **extra_options):
...
propose to split the args by meaning by refactoring like:
two naming options: inject_context or use_context
def populate_with(data, inject_context=False, context_name='context', **extra_options):
...
or
def populate_with(data, use_context=False, context_name='context', **extra_options):
...
also propose to add a customized context wrapper in the decorator wrapper :
rename the wrap_context function to default_context_wrapper
and the decorator function became like this
def populate_with(data, use_context=False, context_name='context', context_wrapper=default_context_wrapper, **extra_options):
...
result = populate(data, **extra_options)
if use_context:
if context_wrapper:
context = context_wrapper(result)
else:
context = result
kwargs[context_name] = context
...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.