cloudforet-io / plugin-aws-ec2-inven-collector

Plugin for AWS EC2
Apache License 2.0
6 stars 4 forks source link

mongoengine.errors.LookUpError: Cannot resolve field "launched_at" #6

Closed jihyungSong closed 1 year ago

jihyungSong commented 2 years ago

An error is occurring in Inventory service.

2022-10-21T13:41:41.954Z [INFO] tnx-d77027968228 domain-58010aa2e451 seolmin@mz.co.kr CloudService.list (service.py:98) (REQUEST) => {"query": {"filter": [{"k": "provider", "v": "aws", "o": "eq"}, {"k": "cloud_service_group", "v": "EC2", "o": "eq"}, {"k": "cloud_service_type", "v": "Instance", "o": "eq"}], "sort": {"key": "created_at", "desc": true}, "page": {"start": 1, "limit": 15}, "only": ["name", "data.compute.instance_state", "data.compute.instance_type", "data.hardware.core", "data.hardware.memory", "data.compute.az", "data.os.os_distro", "data.primary_ip_address", "account", "provider", "region_code", "project_id", "updated_at", "launched_at", "cloud_service_group", "cloud_service_type", "collection_info.service_accounts", "collection_info.secrets", "collection_info.collectors", "created_at", "deleted_at", "reference.resource_id", "reference.external_link", "cloud_service_id", "tags", "provider"]}, "domain_id": "domain-58010aa2e451"}
2022-10-21T13:41:41.956Z [ERROR] tnx-d77027968228 domain-58010aa2e451 seolmin@mz.co.kr CloudService.list (service.py:146) (Error) => Database query failed. (reason = Cannot resolve field "launched_at")
    error_code = ERROR_DB_QUERY
    status_code = INTERNAL
    message = Database query failed. (reason = Cannot resolve field "launched_at")  Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/spaceone/core/model/mongo_model/__init__.py", line 548, in query
    vos = vos.only(*only)
  File "/usr/local/lib/python3.8/site-packages/mongoengine/queryset/base.py", line 1014, in only
    return self.fields(True, **fields)
  File "/usr/local/lib/python3.8/site-packages/mongoengine/queryset/base.py", line 1085, in fields
    fields = queryset._fields_to_dbfields(fields)
  File "/usr/local/lib/python3.8/site-packages/mongoengine/queryset/base.py", line 1884, in _fields_to_dbfields
    raise err
  File "/usr/local/lib/python3.8/site-packages/mongoengine/queryset/base.py", line 1863, in _fields_to_dbfields
    for f in self._document._lookup_field(field_parts)
  File "/usr/local/lib/python3.8/site-packages/mongoengine/base/document.py", line 1135, in _lookup_field
    raise LookUpError('Cannot resolve field "%s"' % field_name)
mongoengine.errors.LookUpError: Cannot resolve field "launched_at"

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/spaceone_inventory-1.10.3rc1-py3.8.egg/spaceone/inventory/api/v1/cloud_service.py", line 45, in list
    cloud_svc_vos, total_count = cloud_svc_service.list(params)
  File "/usr/local/lib/python3.8/site-packages/spaceone/core/service/service.py", line 58, in wrapped_func
    return _pipeline(func, self, params, append_meta)
  File "/usr/local/lib/python3.8/site-packages/spaceone/core/service/service.py", line 121, in _pipeline
    raise e
  File "/usr/local/lib/python3.8/site-packages/spaceone/core/service/service.py", line 107, in _pipeline
    response_or_iterator = func(self, params)
  File "/usr/local/lib/python3.8/site-packages/spaceone/core/service/utils.py", line 41, in wrapped_func
    return func(cls, params)
  File "/usr/local/lib/python3.8/site-packages/spaceone/core/service/utils.py", line 64, in wrapped_func
    return func(cls, params)
  File "/usr/local/lib/python3.8/site-packages/spaceone/core/service/utils.py", line 180, in wrapped_func
    return func(cls, params)
  File "/usr/local/lib/python3.8/site-packages/spaceone_inventory-1.10.3rc1-py3.8.egg/spaceone/inventory/service/cloud_service_service.py", line 322, in list
    return self.cloud_svc_mgr.list_cloud_services(query)
  File "/usr/local/lib/python3.8/site-packages/spaceone_inventory-1.10.3rc1-py3.8.egg/spaceone/inventory/manager/cloud_service_manager.py", line 77, in list_cloud_services
    return self.cloud_svc_model.query(**query, target=target)
  File "/usr/local/lib/python3.8/site-packages/spaceone/core/model/mongo_model/__init__.py", line 575, in query

In my opinion, The launched_at field is no longer used in cloud service. Therefore, the metadata value referring to launched_at must be deleted.

whdalsrnt commented 1 year ago

Remove launched_at field from metadata (EC2.Instance)

jihyungSong commented 1 year ago

It was checked that launched was excluded from metadata, and it was also checked that Launched value was in Console.

The issue ticket is closed as it is not to be a related.