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

Unable to migrate channels #47

Open
NPastorale opened this issue Sep 19, 2024 · 0 comments
Open

Unable to migrate channels #47

NPastorale opened this issue Sep 19, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@NPastorale
Copy link

Description

When using the migratepolicies.py I am seeing crashes when trying to migrate the channels for some policies

Steps to Reproduce

python3 migratepolicies.py --fromFile list.txt --sourceAccount REDACTED --sourceRegion eu --sourceApiKey REDACTED --targetAccount REDACTED --targetRegion eu --targetApiKey REDACTED

Expected Behavior

All of the channels are migrated for every single policy

Relevant Logs / Console output

2024-09-19 09:32:02,021 - migratepolicies.py - INFO - Using fromFile : list.txt
2024-09-19 09:32:02,022 - migratepolicies.py - INFO - Using sourceAccount : REDACTED
2024-09-19 09:32:02,022 - migratepolicies.py - INFO - sourceRegion : eu
2024-09-19 09:32:02,022 - migratepolicies.py - INFO - Using sourceApiKey : ****************************
2024-09-19 09:32:02,022 - migratepolicies.py - INFO - Using targetAccount : REDACTED
2024-09-19 09:32:02,022 - migratepolicies.py - INFO - targetRegion : eu
2024-09-19 09:32:02,022 - migratepolicies.py - INFO - Using targetApiKey : ****************************
2024-09-19 09:32:02,022 - migratepolicies.py - INFO - Default fetch_channels :True
2024-09-19 09:32:02,022 - migratepolicies.py - INFO - Alert migration started.
2024-09-19 09:32:02,022 - migratepolicies.py - INFO - Fetching latest channel info and policy assignment. This may take a while.....
2024-09-19 09:32:06,271 - migratepolicies.py - INFO - Migrating the following policies:
2024-09-19 09:32:06,272 - migratepolicies.py - INFO - ['REDACTED', 'REDACTED', 'REDACTED', 'REDACTED']
2024-09-19 09:32:06,847 - migratepolicies.py - INFO - Policy exists : REDACTED
2024-09-19 09:32:06,848 - migratepolicies.py - INFO - Updating notification channels for REDACTED
2024-09-19 09:32:06,848 - migratepolicies.py - INFO - Channel already existed : email-REDACTED
2024-09-19 09:32:06,848 - migratepolicies.py - INFO - Channel already existed : email-REDACTED
2024-09-19 09:32:06,848 - migratepolicies.py - INFO - Channel already existed : email-REDACTED
2024-09-19 09:32:06,849 - migratepolicies.py - INFO - Channel already existed : email-REDACTED
2024-09-19 09:32:06,849 - migratepolicies.py - INFO - Channel already existed : email-REDACTED
2024-09-19 09:32:06,849 - migratepolicies.py - INFO - Channel already existed : email-REDACTED
2024-09-19 09:32:06,849 - migratepolicies.py - INFO - Channel already existed : email-REDACTED
2024-09-19 09:32:08,705 - alertsclient.py - INFO - Updated policy with notification channels [REDACTED, REDACTED, REDACTED, REDACTED, REDACTED, REDACTED, REDACTED]
2024-09-19 09:32:09,104 - migratepolicies.py - INFO - Policy exists : REDACTED
2024-09-19 09:32:09,104 - migratepolicies.py - INFO - Updating notification channels for REDACTED
Traceback (most recent call last):
  File "/Users/REDACTED/Downloads/nr-account-migration-2.2.2/migratepolicies.py", line 386, in <module>
    main()
  File "/Users/REDACTED/Downloads/nr-account-migration-2.2.2/migratepolicies.py", line 372, in main
    migrate(
  File "/Users/REDACTED/Downloads/nr-account-migration-2.2.2/migratepolicies.py", line 269, in migrate
    status = migrate_alert_policies(
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/REDACTED/Downloads/nr-account-migration-2.2.2/migratepolicies.py", line 236, in migrate_alert_policies
    update_notification_channels(tgt_api_key, tgt_region, src_policy, tgt_policy, loaded_src_channels,
  File "/Users/REDACTED/Downloads/nr-account-migration-2.2.2/migratepolicies.py", line 165, in update_notification_channels
    for source_channel_id in src_channel_ids:
                             ^^^^^^^^^^^^^^^
UnboundLocalError: cannot access local variable 'src_channel_ids' where it is not associated with a value

Your Environment

  • MacOS Squoia
  • Python 3.12.6

Additional context

It seems like a very core functionality of this script for it to be failing, so I am unsure whether this is a bug or user error. I have tried many times and looked into the channels that did get migrated to see whether there was any difference between those and the ones that were crashing when trying the migration, but I have not been able to find the cause.

@NPastorale NPastorale added the bug Something isn't working label Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant