opentelekomcloud / python-otcextensions

Extension of the OpenStackSDK && OpenStackClient with OpenTelekomCloud services
https://docs.otc-service.com/python-otcextensions
Apache License 2.0
24 stars 26 forks source link

[RDS] type object 'Instance' has no attribute '_get_microversion_for_list' #310

Closed eumel8 closed 2 years ago

eumel8 commented 2 years ago

I tried a openstack rds instance list which failed with

type object 'Instance' has no attribute '_get_microversion_for_list'

Traceback (most recent call last):
  File "/Users/xxxxxxxx/Library/Python/3.9/lib/python/site-packages/cliff/app.py", line 410, in run_subcommand
    result = cmd.run(parsed_args)
  File "/Users/xxxxxxxx/Library/Python/3.9/lib/python/site-packages/osc_lib/command/command.py", line 39, in run
    return super(Command, self).run(parsed_args)
  File "/Users/xxxxxxxx/Library/Python/3.9/lib/python/site-packages/cliff/display.py", line 118, in run
    self.produce_output(parsed_args, column_names, data)
  File "/Users/xxxxxxxx/Library/Python/3.9/lib/python/site-packages/cliff/lister.py", line 122, in produce_output
    self.formatter.emit_list(
  File "/Users/xxxxxxxx/Library/Python/3.9/lib/python/site-packages/cliff/formatters/table.py", line 96, in emit_list
    self.add_rows(x, column_names, data)
  File "/Users/xxxxxxxx/Library/Python/3.9/lib/python/site-packages/cliff/formatters/table.py", line 75, in add_rows
    first_row = next(data_iter)
  File "/Users/xxxxxxxx/Library/Python/3.9/lib/python/site-packages/otcextensions/osclient/rds/v3/instance.py", line 153, in <genexpr>
    return (self.columns, (utils.get_item_properties(
  File "/Users/xxxxxxxx/Library/Python/3.9/lib/python/site-packages/otcextensions/osclient/rds/v3/instance.py", line 43, in set_attributes_for_print
    for instance in instances:
  File "/Users/xxxxxxxx/Library/Python/3.9/lib/python/site-packages/otcextensions/sdk/rds/v3/_base.py", line 32, in list
    microversion = cls._get_microversion_for_list(session)
AttributeError: type object 'Instance' has no attribute '_get_microversion_for_list'
clean_up ListDatabaseInstances: type object 'Instance' has no attribute '_get_microversion_for_list'
END return value: 1

Python 3.8.9

$ pip freeze
aodhclient==3.0.0
appdirs==1.4.4
attrs==22.1.0
autopage==0.5.1
Babel==2.10.3
certifi==2022.9.24
cffi==1.15.1
charset-normalizer==2.1.1
cliff==4.0.0
cmd2==2.4.2
cryptography==38.0.1
debtcollector==2.5.0
decorator==5.1.1
docker==6.0.0
dogpile.cache==1.1.8
fasteners==0.18
futurist==2.4.1
gnocchiclient==7.0.7
idna==3.4
importlib-metadata==4.12.0
iso8601==1.1.0
jmespath==1.0.1
jsonpatch==1.32
jsonpointer==2.3
jsonschema==4.16.0
keystoneauth1==5.0.0
monotonic==1.6
msgpack==1.0.4
munch==2.5.0
murano-pkg-check==0.3.0
netaddr==0.8.0
netifaces==0.11.0
networkx==2.8.6
openstacksdk==0.101.0
os-client-config==2.1.0
os-service-types==1.7.0
osc-lib==2.6.2
oslo.concurrency==5.0.1
oslo.config==9.0.0
oslo.context==5.0.0
oslo.i18n==5.1.0
oslo.log==5.0.0
oslo.serialization==5.0.0
oslo.utils==6.0.1
osprofiler==3.4.3
otcextensions==0.28.1
packaging==21.3
pbr==5.10.0
ply==3.11
prettytable==0.7.2
pycparser==2.21
pydot==1.4.2
pyOpenSSL==22.1.0
pyparsing==3.0.9
pyperclip==1.8.2
pyrsistent==0.18.1
python-cinderclient==9.1.0
python-dateutil==2.8.2
python-keystoneclient==5.0.1
python-novaclient==18.1.0
python-openstackclient==6.0.0
pytz==2022.2.1
PyYAML==6.0
requests==2.28.1
requestsexceptions==1.4.0
rfc3986==2.0.0
semantic-version==2.10.0
simplejson==3.17.6
stevedore==4.0.0
ujson==5.5.0
urllib3==1.26.12
warlock==2.0.1
wcwidth==0.2.5
WebOb==1.8.7
websocket-client==1.4.1
wrapt==1.14.1
yaql==2.0.0
zipp==3.8.1

Just wondering why it worked yesterday.

lego963 commented 2 years ago

@eumel8 can you try to downgrade openstacksdk==0.61.0

I suppose that it can be a problem

eumel8 commented 2 years ago

@lego963 result: No module named 'openstack.common'

otcextensions==0.26.3 works, otcextensions==0.27.0 is also broken (with openstacksdk==0.61.0)

pdstefan commented 2 years ago

Same behavior with openstack --os-cloud otc cce cluster show.

Downgrading openstacksdk to 0.61.0 fixes the warning but I get the following warning:

root@78c4479bd56b:/# openstack --os-cloud otc cce cluster list
Configured hook otcextensions.sdk:load cannot be executed: No module named 'openstack.common'
+--------------------------------------+----------------+-----------+--------------+---------+--------------------------------------------------------------------------+
| ID                                   | name           | status    | flavor       | version | endpoint                                                                 |
+--------------------------------------+----------------+-----------+--------------+---------+--------------------------------------------------------------------------+
| 295d49ec-88df-11ec-a392 | x-production | Available | cce.s2.large | v1.21   | https://295d49ec-88df-11ec-a392.cce.eu-de.otc.t-systems.com |
+--------------------------------------+----------------+-----------+--------------+---------+--------------------------------------------------------------------------+
root@78c4479bd56b:/# openstack --os-cloud otc cce cluster node create  --availability-zone eu-de-03  --flavor s3.4xlarge.4   --network 8d9ae731-c1c3-4367-ad78 --ssh-key x-production-ssh  --k8s-tag usage=worker  --k8s-tag added=from_script  --tag key=app,value=x --tag key=env,value=production  --annotation keyname1=valuename1  x-production
Configured hook otcextensions.sdk:load cannot be executed: No module named 'openstack.common'

Running in docker using python 3.9.14, openstack-client 6.0.0 and otcextensions 0.28.1.

FROM  python:3.9.14-slim-buster

RUN pip install openstacksdk==0.61.0 && \
    pip install python-openstackclient   && \
    pip install otcextensions && \ 
    mkdir -p ~/.config/openstack/ && \

COPY clouds.yaml /root/.config/openstack/clouds.yaml

RUN openstack --version
RUN openstack --os-cloud otc cce cluster list
lego963 commented 2 years ago

@pdstefan can you pin python-openstackclient==5.8.0?

pdstefan commented 2 years ago

python-openstackclient==5.8.0

Not good. Same behavior as previously mentioned (Configured hook otcextensions.sdk:load cannot be executed: No module named 'openstack.common')

After playing around with versions, I got back the original behavior:

root@25619c6f772a:/# openstack --os-cloud otc cce cluster node create  --availability-zone eu-de-03  --flavor s3.4xlarge.4   --network 8d9ae731-c1c3-4367-ad78 --ssh-key x-production-ssh  --k8s-tag usage=worker  --k8s-tag added=from_script  --tag key=app,value=x--tag key=env,value=production  --annotation keyname1=valuename1  x-production
(('id', 'name', 'private_ip', 'public_ip', 'status', 'flavor', 'ssh_key', 'availability_zone', 'operating_system', 'root_volume_type', 'root_volume_size', 'data_volume_type_1', 'data_volume_size_1'), ('9ec1b9cc-48a2-11ed-9205-02550a100044', 'x-production-xjp85', None, None, None, 's3.4xlarge.4', 'x-production-ssh', 'eu-de-03', 'EulerOS 2.9', 'SATA', 40, 'SATA', 100))

Dockerfile:

FROM  python:3.9.14-slim-buster

RUN pip install openstacksdk==0.61.0 && \
    pip install python-openstackclient && \
    pip install otcextensions==0.26.3 && \ 
    mkdir -p ~/.config/openstack/ && \

COPY clouds.yaml /root/.config/openstack/clouds.yaml

RUN openstack --version
RUN openstack --os-cloud otc cce cluster list

Relevant output:

Removing intermediate container 7469a7b77011
 ---> 79bb97ab2c34
Step 3/5 : COPY clouds.yaml /root/.config/openstack/clouds.yaml
 ---> a7abcfac6d5c
Step 4/5 : RUN openstack --version
 ---> Running in fec1a6069b1e
openstack 6.0.0
Removing intermediate container fec1a6069b1e
 ---> f4741961d09c
Step 5/5 : RUN openstack --os-cloud otc cce cluster list
 ---> Running in 938f026cedab
+--------------------------------------+----------------+-----------+--------------+---------+--------------------------------------------------------------------------+
| ID                                   | name           | status    | flavor       | version | endpoint                                                                 |
+--------------------------------------+----------------+-----------+--------------+---------+--------------------------------------------------------------------------+
| 295d49ec-88df-11ec-a392 | x-production | Available | cce.s2.large | v1.21   | https://295d49ec-88df-11ec-a392- .cce.eu-de.otc.t-systems.com |
+--------------------------------------+----------------+-----------+--------------+---------+--------------------------------------------------------------------------+
Removing intermediate container 938f026cedab
 ---> 712fe15d6e39
Successfully built 712fe15d6e39
Successfully tagged openstack-cli:latest
anton-sidelnikov commented 2 years ago

latest stable version is otcextensions==0.26.3 with openstacksdk==0.61.0, newest versions of sdk has bunch of changes which brakes the backward compatibility. Will try to update

anton-sidelnikov commented 2 years ago

@eumel8 fun fact that's we already fixed this on 0.99.0 version of sdk (https://github.com/opentelekomcloud/python-otcextensions/pull/309), and on 0.101.0 it again reproducible

anton-sidelnikov commented 2 years ago

@pdstefan @eumel8 try new release with latest's versions, should work

eumel8 commented 2 years ago

thx @anton-sidelnikov Are you sure this release is uploaded to pypi? The release job is marked with post_failure and I couldn't found it in the repo. https://zuul.otc-service.com/t/eco/builds?job_name=release-python&project=opentelekomcloud/python-otcextensions

gtema commented 2 years ago

In few minutes will be uploaded. We switched to Ansible 6 and it has bit different behavior for shebangs in the modules

gtema commented 2 years ago

https://pypi.org/project/otcextensions/0.28.2/

eumel8 commented 2 years ago

yes , worked now:

otcextensions==0.28.2
openstacksdk==0.101.0

many thx @anton-sidelnikov @gtema

pdstefan commented 2 years ago

Confirmed working with latest openstacksdk and python-openstackclient.

FROM  python:3.9.14-slim-buster

RUN apt update ; apt install git nano -y  && \
    pip install openstacksdk  && \
    pip install python-openstackclient && \
    pip install git+https://github.com/opentelekomcloud/python-otcextensions@0.28.2  && \
    mkdir -p ~/.config/openstack/

COPY clouds.yaml /root/.config/openstack/clouds.yaml

RUN openstack --version
RUN openstack --os-cloud otc cce cluster list