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

Error creating Docker Container entities #77

Open chbrown13 opened 7 years ago

chbrown13 commented 7 years ago

Description

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)

What I Did

test_docker_containers.yaml

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