Skip to content

IBM Cloud tagger fails to tag schematics_workspaces #985

Description

@bdattoma

Describe the bug
When running the ibm cloud resource tagger policy, the script errors out on

response = self.__client.list_locations().get_result()

To Reproduce
Steps to reproduce the behavior:

  1. run:
podman run --rm --name cloud-governance -e PUBLIC_CLOUD_NAME="IBM" \
-e policy="tag_resources" \
-e account="<accountname>" \
-e IBM_CLOUD_API_KEY="<apikey>" \
-e IBM_CUSTOM_TAGS_LIST="tag1:mytag1,tag2:mytag2" \
-e IBM_ACCOUNT_ID="<accountid>" \
-e RESOURCE_TO_TAG="resource_instances,virtual_servers,schematics_workspaces"
quay.io/cloud-governance/cloud-governance:latest

Expected behavior
No errors, resources tagged

Screenshots
None

Desktop (please complete the following information):

  • OS: [e.g. iOS] Fedora 42
  • Browser [e.g. chrome, safari] N/A
  • Version [e.g. 22]: using "latest" image tag

I also run it from Code Engine (automatic job run in IBM Cloud) following this guide https://github.com/p8r-the-gr8/ibm-cloud-auto-tagging

Smartphone (please complete the following information):
N/A

Additional context
Logs:

/usr/local/lib/python3.13/site-packages/cloud_governance/common/clouds/aws/price/price.py:5: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
  from pkg_resources import resource_filename
[WARNING] 2026-04-02 13:36:04,851 <accountName> - Method name: main , Start time: 2026-04-02 13:36:04 
[INFO] 2026-04-02 13:36:04,851 <accountName> - Method name: main {}
[INFO] 2026-04-02 13:36:04,851 <accountName> - Running polices: ['tag_resources']
[INFO] 2026-04-02 13:36:04,851 <accountName> - CloudName=IBM, account=<accountName>, policy=tag_resources, dry_run=yes
[WARNING] 2026-04-02 13:36:04,981 <accountName> - Method name: tag_all_resources , Start time: 2026-04-02 13:36:04 
[INFO] 2026-04-02 13:36:04,981 <accountName> - Method name: tag_all_resources {}
[INFO] 2026-04-02 13:36:04,981 <accountName> - Running tag operation on total of 1 resources
[WARNING] 2026-04-02 13:36:04,981 <accountName> - Method name: get_schematics_workspaces_crn , Start time: 2026-04-02 13:36:04 
[INFO] 2026-04-02 13:36:04,981 <accountName> - Method name: get_schematics_workspaces_crn {}
[ERROR] 2026-04-02 13:36:04,981 <accountName> - Method name: get_schematics_workspaces_crn , End time with errors: 2026-04-02 13:36:04 , Total time: 0.0 sec
[ERROR] 2026-04-02 13:36:04,981 <accountName> - Method name: tag_all_resources , End time with errors: 2026-04-02 13:36:04 , Total time: 0.0 sec
[ERROR] 2026-04-02 13:36:04,981 <accountName> - Method name: main , End time with errors: 2026-04-02 13:36:04 , Total time: 0.13 sec
Traceback (most recent call last):
  File "/usr/local/cloud_governance/main.py", line 355, in <module>
    main()
    ~~~~^^
  File "/usr/local/lib/python3.13/site-packages/cloud_governance/common/logger/logger_time_stamp.py", line 42, in method_wrapper
    raise err  # Exception(method.__name__, err)
    ^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/cloud_governance/common/logger/logger_time_stamp.py", line 30, in method_wrapper
    result = method(*args, **kwargs)
  File "/usr/local/cloud_governance/main.py", line 224, in main
    response = main_operations.run()
  File "/usr/local/lib/python3.13/site-packages/cloud_governance/main/main_oerations/main_operations.py", line 50, in run
    policy_runner.run(source=source)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/cloud_governance/policy/policy_runners/common/abstract_policy_runner.py", line 91, in run
    response = self.execute_policy(policy_class_name=cls[0], run_policy=cls[1], upload=upload)
  File "/usr/local/lib/python3.13/site-packages/cloud_governance/policy/policy_runners/ibm/policy_runner.py", line 22, in execute_policy
    response = run_policy().run()
  File "/usr/local/lib/python3.13/site-packages/cloud_governance/policy/ibm/tag_resources.py", line 156, in run
    return self.tag_all_resources()
           ~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/site-packages/cloud_governance/common/logger/logger_time_stamp.py", line 42, in method_wrapper
    raise err  # Exception(method.__name__, err)
    ^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/cloud_governance/common/logger/logger_time_stamp.py", line 30, in method_wrapper
    result = method(*args, **kwargs)
  File "/usr/local/lib/python3.13/site-packages/cloud_governance/policy/ibm/tag_resources.py", line 115, in tag_all_resources
    resources_crn = getattr(self, f'get_{vpc_resource}_crn')()
  File "/usr/local/lib/python3.13/site-packages/cloud_governance/policy/ibm/tag_resources.py", line 16, in wrapper
    resource_list = func(*args, **kwargs)
  File "/usr/local/lib/python3.13/site-packages/cloud_governance/common/logger/logger_time_stamp.py", line 42, in method_wrapper
    raise err  # Exception(method.__name__, err)
    ^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/cloud_governance/common/logger/logger_time_stamp.py", line 30, in method_wrapper
    result = method(*args, **kwargs)
  File "/usr/local/lib/python3.13/site-packages/cloud_governance/policy/ibm/tag_resources.py", line 62, in get_schematics_workspaces_crn
    return self.schematic_operations.get_all_workspaces()
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/site-packages/cloud_governance/common/clouds/ibm/developer_tools/schematic_operations.py", line 47, in get_all_workspaces
    locations = self.get_supported_locations()
  File "/usr/local/lib/python3.13/site-packages/cloud_governance/common/clouds/ibm/developer_tools/schematic_operations.py", line 39, in get_supported_locations
    response = self.__client.list_locations().get_result()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'SchematicsV1' object has no attribute 'list_locations'. Did you mean: 'list_actions'?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions