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

awx-migration-24.3.0 failing #15137

Open
5 of 11 tasks
adpavlov opened this issue Apr 24, 2024 · 15 comments
Open
5 of 11 tasks

awx-migration-24.3.0 failing #15137

adpavlov opened this issue Apr 24, 2024 · 15 comments
Assignees

Comments

@adpavlov
Copy link

Please confirm the following

  • I agree to follow this project's code of conduct.
  • I have checked the current issues for duplicates.
  • I understand that AWX is open source software provided for free and that I might not receive a timely response.
  • I am NOT reporting a (potential) security vulnerability. (These should be emailed to [email protected] instead.)

Bug Summary

awx-migration-24.3.0 failing with following error:

Operations to perform:
  Apply all migrations: auth, conf, contenttypes, dab_rbac, dab_resource_registry, main, oauth2_provider, sessions, sites, social_django, sso
Running migrations:
2024-04-24 11:57:29,309 INFO     [-] awx.main.migrations._dab_rbac Created RoleDefinition Project Admin pk=RoleDefinition object (156) with 5 permissions
2024-04-24 11:57:29,313 INFO     [-] awx.main.migrations._dab_rbac Created RoleDefinition Organization Project Admin pk=RoleDefinition object (157) with 7 permissions
2024-04-24 11:57:29,317 INFO     [-] awx.main.migrations._dab_rbac Created RoleDefinition Project Use pk=RoleDefinition object (158) with 2 permissions
2024-04-24 11:57:29,321 INFO     [-] awx.main.migrations._dab_rbac Created RoleDefinition WorkflowJobTemplate Admin pk=RoleDefinition object (159) with 5 permissions
2024-04-24 11:57:29,325 INFO     [-] awx.main.migrations._dab_rbac Created RoleDefinition Organization WorkflowJobTemplate Admin pk=RoleDefinition object (160) with 7 permissions
2024-04-24 11:57:29,329 INFO     [-] awx.main.migrations._dab_rbac Created RoleDefinition WorkflowJobTemplate Execute pk=RoleDefinition object (161) with 2 permissions
2024-04-24 11:57:29,333 INFO     [-] awx.main.migrations._dab_rbac Created RoleDefinition WorkflowJobTemplate Approve pk=RoleDefinition object (162) with 2 permissions
2024-04-24 11:57:29,338 INFO     [-] awx.main.migrations._dab_rbac Created RoleDefinition JobTemplate Admin pk=RoleDefinition object (163) with 4 permissions
2024-04-24 11:57:29,342 INFO     [-] awx.main.migrations._dab_rbac Created RoleDefinition Organization JobTemplate Admin pk=RoleDefinition object (164) with 5 permissions
2024-04-24 11:57:29,346 INFO     [-] awx.main.migrations._dab_rbac Created RoleDefinition JobTemplate Execute pk=RoleDefinition object (165) with 2 permissions
2024-04-24 11:57:29,350 INFO     [-] awx.main.migrations._dab_rbac Created RoleDefinition NotificationTemplate Admin pk=RoleDefinition object (166) with 3 permissions
2024-04-24 11:57:29,354 INFO     [-] awx.main.migrations._dab_rbac Created RoleDefinition Organization NotificationTemplate Admin pk=RoleDefinition object (167) with 5 permissions
2024-04-24 11:57:29,358 INFO     [-] awx.main.migrations._dab_rbac Created RoleDefinition Team Admin pk=RoleDefinition object (168) with 4 permissions
2024-04-24 11:57:29,362 INFO     [-] awx.main.migrations._dab_rbac Created RoleDefinition Organization Team Admin pk=RoleDefinition object (169) with 6 permissions
2024-04-24 11:57:29,366 INFO     [-] awx.main.migrations._dab_rbac Created RoleDefinition Team Member pk=RoleDefinition object (170) with 2 permissions
2024-04-24 11:57:29,370 INFO     [-] awx.main.migrations._dab_rbac Created RoleDefinition Organization Admin pk=RoleDefinition object (171) with 5 permissions
2024-04-24 11:57:29,374 INFO     [-] awx.main.migrations._dab_rbac Created RoleDefinition Organization Organization Admin pk=RoleDefinition object (172) with 5 permissions
2024-04-24 11:57:29,378 INFO     [-] awx.main.migrations._dab_rbac Created RoleDefinition Organization Member pk=RoleDefinition object (173) with 2 permissions
2024-04-24 11:57:29,382 INFO     [-] awx.main.migrations._dab_rbac Created RoleDefinition Organization Audit pk=RoleDefinition object (174) with 2 permissions
2024-04-24 11:57:29,386 INFO     [-] awx.main.migrations._dab_rbac Created RoleDefinition Inventory Admin pk=RoleDefinition object (175) with 6 permissions
2024-04-24 11:57:29,390 INFO     [-] awx.main.migrations._dab_rbac Created RoleDefinition Organization Inventory Admin pk=RoleDefinition object (176) with 8 permissions
2024-04-24 11:57:29,394 INFO     [-] awx.main.migrations._dab_rbac Created RoleDefinition Inventory Use pk=RoleDefinition object (177) with 2 permissions
2024-04-24 11:57:29,398 INFO     [-] awx.main.migrations._dab_rbac Created RoleDefinition Inventory Adhoc pk=RoleDefinition object (178) with 2 permissions
2024-04-24 11:57:29,402 INFO     [-] awx.main.migrations._dab_rbac Created RoleDefinition Credential Admin pk=RoleDefinition object (179) with 4 permissions
2024-04-24 11:57:29,406 INFO     [-] awx.main.migrations._dab_rbac Created RoleDefinition Organization Credential Admin pk=RoleDefinition object (180) with 6 permissions
2024-04-24 11:57:29,410 INFO     [-] awx.main.migrations._dab_rbac Created RoleDefinition Credential Use pk=RoleDefinition object (181) with 2 permissions
2024-04-24 11:57:29,414 INFO     [-] awx.main.migrations._dab_rbac Created RoleDefinition InstanceGroup Admin pk=RoleDefinition object (182) with 4 permissions
2024-04-24 11:57:29,418 INFO     [-] awx.main.migrations._dab_rbac Created RoleDefinition Organization InstanceGroup Admin pk=RoleDefinition object (183) with 5 permissions
2024-04-24 11:57:29,422 INFO     [-] awx.main.migrations._dab_rbac Created RoleDefinition InstanceGroup Use pk=RoleDefinition object (184) with 2 permissions
2024-04-24 11:57:29,426 INFO     [-] awx.main.migrations._dab_rbac Created RoleDefinition ExecutionEnvironment Admin pk=RoleDefinition object (185) with 3 permissions
2024-04-24 11:57:29,430 INFO     [-] awx.main.migrations._dab_rbac Created RoleDefinition Organization ExecutionEnvironment Admin pk=RoleDefinition object (186) with 5 permissions
Traceback (most recent call last):
  File "/usr/bin/awx-manage", line 8, in <module>
    sys.exit(manage())
             ^^^^^^^^
  File "/var/lib/awx/venv/awx/lib64/python3.11/site-packages/awx/__init__.py", line 177, in manage
    execute_from_command_line(sys.argv)
  File "/var/lib/awx/venv/awx/lib64/python3.11/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/var/lib/awx/venv/awx/lib64/python3.11/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/var/lib/awx/venv/awx/lib64/python3.11/site-packages/django/core/management/base.py", line 412, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/var/lib/awx/venv/awx/lib64/python3.11/site-packages/django/core/management/base.py", line 458, in execute
    output = self.handle(*args, **options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/lib/awx/venv/awx/lib64/python3.11/site-packages/django/core/management/base.py", line 106, in wrapper
    res = handle_func(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/lib/awx/venv/awx/lib64/python3.11/site-packages/django/core/management/commands/migrate.py", line 356, in handle
    post_migrate_state = executor.migrate(
                         ^^^^^^^^^^^^^^^^^
  File "/var/lib/awx/venv/awx/lib64/python3.11/site-packages/django/db/migrations/executor.py", line 135, in migrate
    state = self._migrate_all_forwards(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/lib/awx/venv/awx/lib64/python3.11/site-packages/django/db/migrations/executor.py", line 167, in _migrate_all_forwards
    state = self.apply_migration(
            ^^^^^^^^^^^^^^^^^^^^^
  File "/var/lib/awx/venv/awx/lib64/python3.11/site-packages/django/db/migrations/executor.py", line 252, in apply_migration
    state = migration.apply(state, schema_editor)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/lib/awx/venv/awx/lib64/python3.11/site-packages/django/db/migrations/migration.py", line 132, in apply
    operation.database_forwards(
  File "/var/lib/awx/venv/awx/lib64/python3.11/site-packages/django/db/migrations/operations/special.py", line 193, in database_forwards
    self.code(from_state.apps, schema_editor)
  File "/var/lib/awx/venv/awx/lib64/python3.11/site-packages/awx/main/migrations/_dab_rbac.py", line 200, in migrate_to_new_rbac
    role_definition_name = f'{role.content_type.model_class().__name__} {action.title()}'
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'ContentType' object has no attribute 'model_class'
  Applying main.0192_custom_roles...

AWX version

24.3.0

Select the relevant components

  • UI
  • UI (tech preview)
  • API
  • Docs
  • Collection
  • CLI
  • Other

Installation method

kubernetes

Modifications

no

Ansible version

No response

Operating system

No response

Web browser

No response

Steps to reproduce

upgrade ax-operator

Expected results

all working

Actual results

migration failed

Additional information

No response

@NV-LijonFogel
Copy link

Ah you have the same issue, I thought I was alone! I have commented on the PR from @AlanCoding which is responsible for that change.

Environment is external Postgres, but I guess this issue is Django related. Hope to see this fixed soon

@josduppen
Copy link

Same issue here as well

@adpavlov
Copy link
Author

Ah you have the same issue, I thought I was alone! I have commented on the PR from @AlanCoding which is responsible for that change.

Environment is external Postgres, but I guess this issue is Django related. Hope to see this fixed soon

Yes, same issue. And one day I will hardcode awx and operator version and wait at least 2 weeks after new release, but not now:)

postgres is not external in my case, but I also don’t think it’s related.

Did a fallback to previous version and AWX came up.

@NV-LijonFogel
Copy link

Did a fallback to previous version and AWX came up.

Oh, how did you do that? I have deployed AWX via AWX-Operator as a subscirption and did not see an obvious way to downgrade. Also isn't the database incompatible now? A few migrations did run, so the tables are definitly altered.

@kzinas-adv
Copy link

Also upgrade to awx-migration-24.3.0 fail with same error:

AttributeError: 'ContentType' object has no attribute 'model_class'
  Applying main.0192_custom_roles...

@ihriel
Copy link

ihriel commented Apr 24, 2024

Same error here,

And like Adpavlov, my postgres is not external.

@AlanCoding
Copy link
Member

Thank you for the report. I have put a patch up at #15138 but it will take a while to fully verify it because the migration testing takes a while.

@adpavlov
Copy link
Author

Thank you for the report. I have put a patch up at #15138 but it will take a while to fully verify it because the migration testing takes a while.

Probably mark current release as not good for installation?

gundalow referenced this issue Apr 24, 2024
…#15087)

* Rename managed role definitions, and move migration logic here

* Fix naming capitalization
@adpavlov
Copy link
Author

Did a fallback to previous version and AWX came up.

Oh, how did you do that? I have deployed AWX via AWX-Operator as a subscirption and did not see an obvious way to downgrade. Also isn't the database incompatible now? A few migrations did run, so the tables are definitly altered.

Seems like data not affected much and back compatible.
I have local installation and deploying operator as following:

    - name: Download and extract awx-operator into "{{ role_path }}/files"
      ansible.builtin.unarchive:
        src: "https://github.com/ansible/awx-operator/archive/{{ awx_operator_version }}.zip"
        dest: "{{ role_path }}/files"
        owner: "{{ devops.user.name }}"
        group: "{{ devops.user.group }}"
        mode: "0775"
        remote_src: true

    - name: Set DEFAULT_AWX_VERSION to {{ awx_version }} for awx-operator
      ansible.builtin.lineinfile:
        path: "{{ role_path }}/files/awx-operator-{{ awx_operator_version }}/config/manager/manager.yaml"
        regexp: '^.*{{ item }}.*$'
        line: '{{ item }}'
        insertafter: 'env:'
        firstmatch: true
        state: present
        backup: false
      loop:
        - '          value: {{ awx_version }}'
        - '        - name: DEFAULT_AWX_VERSION'
      loop_control:
        label: "Adding {{ item }}"

    - name: Deploy AWX Operator
      ansible.builtin.shell: |
        export DEFAULT_AWX_VERSION={{ awx_version }}
        make deploy
      args:
        chdir: "{{ role_path }}/files/awx-operator-{{ awx_operator_version }}"
      environment:
        PATH: "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin"
        NAMESPACE: awx
        VERSION: "{{ awx_operator_version }}"
        DEFAULT_AWX_VERSION: "{{ awx_version }}"

@thedoubl3j
Copy link
Member

@adpavlov it will be marked as such shortly but not just for this issue, see also #15136

@adpavlov
Copy link
Author

@adpavlov it will be marked as such shortly but not just for this issue, see also #15136

Haven’t reached this issue yet as failed in earlier step😂

@AlanCoding
Copy link
Member

The patch for this issue is merged into the devel branch.

@diarhussein
Copy link

@AlanCoding Trying to deploy using helm install, but i still get the error. What can i do to make it work?

@Nyralei
Copy link

Nyralei commented May 2, 2024

@adpavlov Try 24.3.1

@adpavlov
Copy link
Author

adpavlov commented May 3, 2024

@adpavlov Try 24.3.1

Migration passed fine. Thanks for the fix!

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

No branches or pull requests

9 participants