From f4aaf4d14801ef1af36dfa7cf5290e0d42d51e83 Mon Sep 17 00:00:00 2001 From: yanzhangi <51999930+yanzhangi@users.noreply.github.com> Date: Tue, 13 Aug 2019 09:22:03 +0800 Subject: [PATCH] update ce_aaa_server to fix bugs (#60355) * update ce_aaa_server to fix bugs (#60270) * update ce_aaa_server to fix bugs * update ce_aaa_server to fix bugs (cherry picked from commit c2e76839269b6e80da75e8f39348704b6634f99a) * Update ce_aaa_server modified information --- .../60270-ce_aaa_server-to-fix-bugs.yml | 2 + .../network/cloudengine/ce_aaa_server.py | 75 ++++++++++--------- 2 files changed, 41 insertions(+), 36 deletions(-) create mode 100644 changelogs/fragments/60270-ce_aaa_server-to-fix-bugs.yml diff --git a/changelogs/fragments/60270-ce_aaa_server-to-fix-bugs.yml b/changelogs/fragments/60270-ce_aaa_server-to-fix-bugs.yml new file mode 100644 index 0000000000..d3c9d61080 --- /dev/null +++ b/changelogs/fragments/60270-ce_aaa_server-to-fix-bugs.yml @@ -0,0 +1,2 @@ +bugfixes: +- ce_aaa_server - update to fix some bugs - When you want to delete a parameter, a conflict will occur, causing the download configuration to fail. (https://github.com/ansible/ansible/pull/60270) diff --git a/lib/ansible/modules/network/cloudengine/ce_aaa_server.py b/lib/ansible/modules/network/cloudengine/ce_aaa_server.py index 532ff311d5..9fb740c763 100644 --- a/lib/ansible/modules/network/cloudengine/ce_aaa_server.py +++ b/lib/ansible/modules/network/cloudengine/ce_aaa_server.py @@ -1797,20 +1797,21 @@ def main(): else: # absent authentication scheme - if len(scheme_exist) == 0: - pass - elif scheme_new not in scheme_exist: - pass - else: - cmd = ce_aaa_server.delete_authentication_scheme( - module=module, - authen_scheme_name=authen_scheme_name, - first_authen_mode=first_authen_mode) - updates.append(cmd) - changed = True + if not domain_name: + if len(scheme_exist) == 0: + pass + elif scheme_new not in scheme_exist: + pass + else: + cmd = ce_aaa_server.delete_authentication_scheme( + module=module, + authen_scheme_name=authen_scheme_name, + first_authen_mode=first_authen_mode) + updates.append(cmd) + changed = True # absent authentication domain - if domain_name: + else: domain_exist = ce_aaa_server.get_authentication_domain( module=module) domain_new = (domain_name.lower(), authen_scheme_name.lower()) @@ -1878,20 +1879,21 @@ def main(): else: # absent authorization scheme - if len(scheme_exist) == 0: - pass - elif scheme_new not in scheme_exist: - pass - else: - cmd = ce_aaa_server.delete_authorization_scheme( - module=module, - author_scheme_name=author_scheme_name, - first_author_mode=first_author_mode) - updates.append(cmd) - changed = True + if not domain_name: + if len(scheme_exist) == 0: + pass + elif scheme_new not in scheme_exist: + pass + else: + cmd = ce_aaa_server.delete_authorization_scheme( + module=module, + author_scheme_name=author_scheme_name, + first_author_mode=first_author_mode) + updates.append(cmd) + changed = True # absent authorization domain - if domain_name: + else: domain_exist = ce_aaa_server.get_authorization_domain( module=module) domain_new = (domain_name.lower(), author_scheme_name.lower()) @@ -1959,20 +1961,21 @@ def main(): else: # absent accounting scheme - if len(scheme_exist) == 0: - pass - elif scheme_new not in scheme_exist: - pass - else: - cmd = ce_aaa_server.delete_accounting_scheme( - module=module, - acct_scheme_name=acct_scheme_name, - accounting_mode=accounting_mode) - updates.append(cmd) - changed = True + if not domain_name: + if len(scheme_exist) == 0: + pass + elif scheme_new not in scheme_exist: + pass + else: + cmd = ce_aaa_server.delete_accounting_scheme( + module=module, + acct_scheme_name=acct_scheme_name, + accounting_mode=accounting_mode) + updates.append(cmd) + changed = True # absent accounting domain - if domain_name: + else: domain_exist = ce_aaa_server.get_accounting_domain( module=module) domain_new = (domain_name.lower(), acct_scheme_name.lower())