source/Tools Integration/CE-Integration/CE-automation-scripts/2-UserMgmt-Linux.py [109:162]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                ssh_client.exec_command(no_password_sudoers_cmd)
                print("Modified sudoers to set NOPASSWORD for user " + new_user_name)
            else:
                print("User %s not created on host %s" % (new_user_name, host))
        except paramiko.SSHException as ssh_exception:
            error = "Server fails to execute the AddUser command on host " + host + " with username " + \
                    new_user_name + " due to " + str(ssh_exception)
            print(error)
    except Exception as ex:
        error = "Error while creating user on host " + host + " with username " + \
                new_user_name + " due to " + str(ex)
        print(error)
    finally:
        if ssh_client:
            ssh_client.close()


def delete_linux_user(host, system_login_username, system_key_pwd, using_key, username_to_delete):
    if not username_to_delete:
        print("User name to delete cannot be null or empty")
        return
    ssh_client = None
    try:
        ssh_client = open_ssh(host, system_login_username, system_key_pwd, using_key)
        try:
            delete_user_cmd = 'sudo userdel -r ' + username_to_delete
            ssh_client.exec_command(delete_user_cmd)
            ssh_client.exec_command("sleep 2")
            stdin, stdout, stderr = ssh_client.exec_command("cut -d: -f1 /etc/passwd")
            users_output_str = stdout.read().decode("utf-8")
            users_list = users_output_str.split("\n")
            if not username_to_delete in users_list:
                print("User deleted successfully on " + host)
            else:
                print("Deletion of user %s is not successfull on %s" %(
                    username_to_delete, host))
        except paramiko.SSHException as ssh_exception:
            error = "Server fails to execute the AddUser command on host " + host + " with username " + \
                    username_to_delete + " due to " + str(ssh_exception)
            print(error)
    except Exception as ex:
        error = "Error while deleting user on host " + host + " with username " + \
                username_to_delete + " due to " + str(ex)
        print(error)
    finally:
        if ssh_client:
            ssh_client.close()


def main(arguments):
    parser = argparse.ArgumentParser(
        description=__doc__,
        formatter_class=argparse.RawDescriptionHelpFormatter)
    parser.add_argument('--Waveid', required=True)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



source/Tools Integration/MGN-Integration/MGN-automation-scripts/2-UserMgmt.py [116:168]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                ssh_client.exec_command(no_password_sudoers_cmd)
                print("Modified sudoers to set NOPASSWORD for user " + new_user_name)
            else:
                print("User %s not created on host %s" % (new_user_name, host))
        except paramiko.SSHException as ssh_exception:
            error = "Server fails to execute the AddUser command on host " + host + " with username " + \
                    new_user_name + " due to " + str(ssh_exception)
            print(error)
    except Exception as ex:
        error = "Error while creating user on host " + host + " with username " + \
                new_user_name + " due to " + str(ex)
        print(error)
    finally:
        if ssh_client:
            ssh_client.close()


def delete_linux_user(host, system_login_username, system_key_pwd, using_key, username_to_delete):
    if not username_to_delete:
        print("User name to delete cannot be null or empty")
        return
    ssh_client = None
    try:
        ssh_client = open_ssh(host, system_login_username, system_key_pwd, using_key)
        try:
            delete_user_cmd = 'sudo userdel -r ' + username_to_delete
            ssh_client.exec_command(delete_user_cmd)
            ssh_client.exec_command("sleep 2")
            stdin, stdout, stderr = ssh_client.exec_command("cut -d: -f1 /etc/passwd")
            users_output_str = stdout.read().decode("utf-8")
            users_list = users_output_str.split("\n")
            if not username_to_delete in users_list:
                print("User deleted successfully on " + host)
            else:
                print("Deletion of user %s is not successfull on %s" %(
                    username_to_delete, host))
        except paramiko.SSHException as ssh_exception:
            error = "Server fails to execute the AddUser command on host " + host + " with username " + \
                    username_to_delete + " due to " + str(ssh_exception)
            print(error)
    except Exception as ex:
        error = "Error while deleting user on host " + host + " with username " + \
                username_to_delete + " due to " + str(ex)
        print(error)
    finally:
        if ssh_client:
            ssh_client.close()

def main(arguments):
    parser = argparse.ArgumentParser(
        description=__doc__,
        formatter_class=argparse.RawDescriptionHelpFormatter)
    parser.add_argument('--Waveid', required=True)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



