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

Add dump_auth_config management cmd (for SAML and LDAP) #14947

Merged
merged 10 commits into from
Mar 15, 2024

Conversation

TheRealHaoLiu
Copy link
Member

@TheRealHaoLiu TheRealHaoLiu commented Mar 4, 2024

SUMMARY
  • Dump SAML config from AWX to DAB authenticator config in json format
  • Dump LDAP config ...
ISSUE TYPE
  • New or Enhanced Feature
COMPONENT NAME
  • Other
AWX VERSION
awx: 23.9.1.dev8+gd6e63469cb
ADDITIONAL INFORMATION

- Dump SAML config from AWX to DAB authenticator config in json format
@TheRealHaoLiu TheRealHaoLiu changed the title Add dump_auth_config management cmd (for SAML) Add dump_auth_config management cmd (for SAML and LDAP) Mar 4, 2024
@dmzoneill dmzoneill marked this pull request as draft March 5, 2024 13:02
@TheRealHaoLiu
Copy link
Member Author

@jessicamack

[gw0] linux -- Python 3.9.18 /var/lib/awx/venv/awx/bin/python3.9
Traceback (most recent call last):
  File "/awx_devel/awx/main/management/commands/dump_auth_config.py", line 137, in handle
    self.format_config_data(
  File "/awx_devel/awx/main/management/commands/dump_auth_config.py", line 111, in format_config_data
    value = awx_settings["ENABLED_IDPS"][idp_name].get(key)
TypeError: string indices must be integers

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib64/python3.9/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/usr/lib64/python3.9/unittest/case.py", line 592, in run
    self._callTestMethod(testMethod)
  File "/usr/lib64/python3.9/unittest/case.py", line 550, in _callTestMethod
    method()
  File "/awx_devel/awx/main/tests/unit/commands/test_dump_auth_config.py", line 79, in test_json_returned_from_cmd
    call_command("dump_auth_config", stdout=output)
  File "/var/lib/awx/venv/awx/lib64/python3.9/site-packages/django/core/management/__init__.py", line 194, in call_command
    return command.execute(*args, **defaults)
  File "/var/lib/awx/venv/awx/lib64/python3.9/site-packages/django/core/management/base.py", line 458, in execute
    output = self.handle(*args, **options)
  File "/awx_devel/awx/main/management/commands/dump_auth_config.py", line 179, in handle
    sys.exit(1)
SystemExit: 1

@jessicamack
Copy link
Member

jessicamack commented Mar 11, 2024

[gw0] linux -- Python 3.9.18 /var/lib/awx/venv/awx/bin/python3.9
Traceback (most recent call last):
  File "/awx_devel/awx/main/management/commands/dump_auth_config.py", line 137, in handle
    self.format_config_data(
  File "/awx_devel/awx/main/management/commands/dump_auth_config.py", line 111, in format_config_data
    value = awx_settings["ENABLED_IDPS"][idp_name].get(key)
TypeError: string indices must be integers

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib64/python3.9/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/usr/lib64/python3.9/unittest/case.py", line 592, in run
    self._callTestMethod(testMethod)
  File "/usr/lib64/python3.9/unittest/case.py", line 550, in _callTestMethod
    method()
  File "/awx_devel/awx/main/tests/unit/commands/test_dump_auth_config.py", line 79, in test_json_returned_from_cmd
    call_command("dump_auth_config", stdout=output)
  File "/var/lib/awx/venv/awx/lib64/python3.9/site-packages/django/core/management/__init__.py", line 194, in call_command
    return command.execute(*args, **defaults)
  File "/var/lib/awx/venv/awx/lib64/python3.9/site-packages/django/core/management/base.py", line 458, in execute
    output = self.handle(*args, **options)
  File "/awx_devel/awx/main/management/commands/dump_auth_config.py", line 179, in handle
    sys.exit(1)
SystemExit: 1

@TheRealHaoLiu can you share your SAML settings? I don't run into this error when I run the command

@TheRealHaoLiu
Copy link
Member Author

TheRealHaoLiu commented Mar 12, 2024

@jessicamack jessicamack marked this pull request as ready for review March 13, 2024 21:57
@jessicamack jessicamack requested a review from jbradberry March 15, 2024 16:24
@jessicamack jessicamack requested a review from fosterseth March 15, 2024 17:29
@jessicamack jessicamack merged commit 8ff7260 into ansible:devel Mar 15, 2024
20 of 21 checks passed
AlanCoding pushed a commit to AlanCoding/awx that referenced this pull request Mar 18, 2024
* Add dump_auth_config management cmd

- Dump SAML config from AWX to DAB authenticator config in json format

* Add dumping of LDAP settings

* add test for command

* Fix is_enabled

* fix command name typo

Co-authored-by: Hao Liu <44379968+TheRealHaoLiu@users.noreply.github.com>

* add fields to config, add name to data

* break out IDP values

* change test fields and value comparison

* edit help text, reformat settings

---------

Co-authored-by: jessicamack <jmack@redhat.com>
@TheRealHaoLiu TheRealHaoLiu deleted the dump-saml-config branch March 19, 2024 13:02
djyasin pushed a commit to djyasin/awx that referenced this pull request Sep 16, 2024
* Add dump_auth_config management cmd

- Dump SAML config from AWX to DAB authenticator config in json format

* Add dumping of LDAP settings

* add test for command

* Fix is_enabled

* fix command name typo

Co-authored-by: Hao Liu <44379968+TheRealHaoLiu@users.noreply.github.com>

* add fields to config, add name to data

* break out IDP values

* change test fields and value comparison

* edit help text, reformat settings

---------

Co-authored-by: jessicamack <jmack@redhat.com>
djyasin pushed a commit to djyasin/awx that referenced this pull request Nov 11, 2024
* Add dump_auth_config management cmd

- Dump SAML config from AWX to DAB authenticator config in json format

* Add dumping of LDAP settings

* add test for command

* Fix is_enabled

* fix command name typo

Co-authored-by: Hao Liu <44379968+TheRealHaoLiu@users.noreply.github.com>

* add fields to config, add name to data

* break out IDP values

* change test fields and value comparison

* edit help text, reformat settings

---------

Co-authored-by: jessicamack <jmack@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants