Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stop_vmss action doesn't work #132

Open
okumurays opened this issue Aug 2, 2021 · 0 comments
Open

stop_vmss action doesn't work #132

okumurays opened this issue Aug 2, 2021 · 0 comments

Comments

@okumurays
Copy link

I tried to use stop_vmss action, but it doesn't work.
debug log is following.

・[32m[2021-08-01 21:18:31 INFO] [activity:161] [39m Action: stop-vmss
・[36m[2021-08-01 21:18:31 DEBUG] [python:34] [39m Activity 'stop-vmss' loaded from '\chaostkcheck\lib\site-packages\chaosazure\vmss\actions.py'
・[36m[2021-08-01 21:18:31 DEBUG] [actions:143] [39m Starting stop_vmss: configuration='{'azure_subscription_id': '1e6068d8-cfa7-4b67-9f26-d134c9b026cd'}', filter='None'
・[33m[2021-08-01 21:18:31 WARNING] [cloud:16] [39m Azure cloud not provided. Using AZURE_PUBLIC_CLOUD as default
・[36m[2021-08-01 21:18:32 DEBUG] [fetcher:54] [39m Fetched VMSS: ['chaos-test']
・[33m[2021-08-01 21:18:32 WARNING] [cloud:16] [39m Azure cloud not provided. Using AZURE_PUBLIC_CLOUD as default
・[36m[2021-08-01 21:18:32 DEBUG] [activity:235] [39m Activity failed
    Traceback (most recent call last):
      File "\chaostkcheck\lib\site-packages\chaoslib\provider\python.py", line 55, in run_python_activity
        return func(**arguments)
      File "\chaostkcheck\lib\site-packages\chaosazure\vmss\actions.py", line 151, in stop_vmss
        instances = fetch_instances(scale_set, instance_criteria,
      File "\chaostkcheck\lib\site-packages\chaosazure\vmss\fetcher.py", line 16, in fetch_instances
        instance = __random_instance_from(
      File "\chaostkcheck\lib\site-packages\chaosazure\vmss\fetcher.py", line 86, in __random_instance_from
        instances = __fetch_vmss_instances(
      File "\chaostkcheck\lib\site-packages\chaosazure\vmss\fetcher.py", line 68, in __fetch_vmss_instances
        first_page = pages.advance_page()
    AttributeError: 'ItemPaged' object has no attribute 'advance_page'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "\chaostkcheck\lib\site-packages\chaoslib\activity.py", line 228, in run_activity
        result = run_python_activity(activity, configuration, secrets)
      File "\chaostkcheck\lib\site-packages\chaoslib\provider\python.py", line 57, in run_python_activity
        raise ActivityFailed(
      File "\chaostkcheck\lib\site-packages\chaoslib\provider\python.py", line 55, in run_python_activity
        return func(**arguments)
      File "\chaostkcheck\lib\site-packages\chaosazure\vmss\actions.py", line 151, in stop_vmss
        instances = fetch_instances(scale_set, instance_criteria,
      File "\chaostkcheck\lib\site-packages\chaosazure\vmss\fetcher.py", line 16, in fetch_instances
        instance = __random_instance_from(
      File "\chaostkcheck\lib\site-packages\chaosazure\vmss\fetcher.py", line 86, in __random_instance_from
        instances = __fetch_vmss_instances(
      File "\chaostkcheck\lib\site-packages\chaosazure\vmss\fetcher.py", line 68, in __fetch_vmss_instances
        first_page = pages.advance_page()
    chaoslib.exceptions.ActivityFailed: AttributeError: 'ItemPaged' object has no attribute 'advance_page'
・[31m[2021-08-01 21:18:32 ERROR] [activity:188] [39m   => failed: AttributeError: 'ItemPaged' object has no attribute 'advance_page'

Currently there is no advance_page attribute in ItemPaged class
https://docs.microsoft.com/en-us/python/api/azure-core/azure.core.paging.itempaged?view=azure-python

My environment is here

・OS:Windows 10 Home (build 19043.1110)
・Python:3.9.6
・packages
azure-common             1.1.27
azure-core               1.16.0
azure-identity           1.6.0
azure-mgmt-compute       20.0.0
azure-mgmt-core          1.3.0
azure-mgmt-resourcegraph 8.0.0
azure-mgmt-web           3.0.0
chaostoolkit             1.9.1
chaostoolkit-azure       0.10.0
chaostoolkit-lib         1.19.0

I think the following code is one way to fix it:

    result = client.virtual_machine_scale_set_vms.list(
        choice['resourceGroup'], choice['name'])
    for item in result:
        logger.info(item.name)
        vmss_instances.append(item)

But we also need to consider paging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant