vaultmanager/modules/VaultManagerLDAP.py
def ldap_manage_ldap_groups(self):
        """
        Method running the manage-ldap-groups function of LDAP module
        Manage groups in Vault LDAP configuration
        """
        self.logger.debug("LDAP manage-ldap-groups starting")
        self.logger.info("Managing groups in Vault LDAP '%s' config" %
                         self.kwargs.manage_ldap_groups)
        self.logger.debug("Managing groups to Vault LDAP configuration")
        raw_vault_ldap_groups = self.vault_client.list('/auth/ldap/groups')
        existing_groups = []
        if len(raw_vault_ldap_groups):
            existing_groups = raw_vault_ldap_groups["keys"]
        for group in self.conf["groups"]["groups_to_add"]:
            if group in existing_groups:
                existing_groups.remove(group)
            policies = ["group_" + group + "_policy"]
            if "root" in self.conf["general"]["group"] and \
                    group in self.conf["general"]["group"]["root"]:
                policies.append("root")
            self.logger.info("Adding polices %s to group %s" %
                             (str(policies), group))
            self.vault_client.write(
                "/auth/ldap/groups/" + group,
                {
                    "policies": utils.list_to_string(
                        self.logger, policies, separator=""
                    )
                }
            )
        self.logger.debug("Removing groups %s from Vault LDAP conf" %
                          str(existing_groups))
        for group in existing_groups:
            self.logger.info("Removing group %s from Vault LDAP conf" % group)
            self.vault_client.delete('/auth/ldap/groups/' + group)

        Method running the manage-ldap-groups function of LDAP module
        Manage groups in Vault LDAP configuration
        
Method running the manage-ldap-groups function of LDAP module
Manage groups in Vault LDAP configuration
Method running the manage - ldap - groups function of LDAP module Manage groups in Vault LDAP configuration
def ldap_manage_ldap_groups(self):
        self.logger.debug("LDAP manage-ldap-groups starting")
        self.logger.info("Managing groups in Vault LDAP '%s' config" %
                         self.kwargs.manage_ldap_groups)
        self.logger.debug("Managing groups to Vault LDAP configuration")
        raw_vault_ldap_groups = self.vault_client.list('/auth/ldap/groups')
        existing_groups = []
        if len(raw_vault_ldap_groups):
            existing_groups = raw_vault_ldap_groups["keys"]
        for group in self.conf["groups"]["groups_to_add"]:
            if group in existing_groups:
                existing_groups.remove(group)
            policies = ["group_" + group + "_policy"]
            if "root" in self.conf["general"]["group"] and \
                    group in self.conf["general"]["group"]["root"]:
                policies.append("root")
            self.logger.info("Adding polices %s to group %s" %
                             (str(policies), group))
            self.vault_client.write(
                "/auth/ldap/groups/" + group,
                {
                    "policies": utils.list_to_string(
                        self.logger, policies, separator=""
                    )
                }
            )
        self.logger.debug("Removing groups %s from Vault LDAP conf" %
                          str(existing_groups))
        for group in existing_groups:
            self.logger.info("Removing group %s from Vault LDAP conf" % group)
            self.vault_client.delete('/auth/ldap/groups/' + group)
def ldap_manage_ldap_groups ( self ) : self . logger . debug ( "LDAP manage-ldap-groups starting" ) self . logger . info ( "Managing groups in Vault LDAP '%s' config" % self . kwargs . manage_ldap_groups ) self . logger . debug ( "Managing groups to Vault LDAP configuration" ) raw_vault_ldap_groups = self . vault_client . list ( '/auth/ldap/groups' ) existing_groups = [ ] if len ( raw_vault_ldap_groups ) : existing_groups = raw_vault_ldap_groups [ "keys" ] for group in self . conf [ "groups" ] [ "groups_to_add" ] : if group in existing_groups : existing_groups . remove ( group ) policies = [ "group_" + group + "_policy" ] if "root" in self . conf [ "general" ] [ "group" ] and group in self . conf [ "general" ] [ "group" ] [ "root" ] : policies . append ( "root" ) self . logger . info ( "Adding polices %s to group %s" % ( str ( policies ) , group ) ) self . vault_client . write ( "/auth/ldap/groups/" + group , { "policies" : utils . list_to_string ( self . logger , policies , separator = "" ) } ) self . logger . debug ( "Removing groups %s from Vault LDAP conf" % str ( existing_groups ) ) for group in existing_groups : self . logger . info ( "Removing group %s from Vault LDAP conf" % group ) self . vault_client . delete ( '/auth/ldap/groups/' + group )
Method running the manage-ldap-groups function of LDAP module
Manage groups in Vault LDAP configuration
Method running the manage - ldap - groups function of LDAP module Manage groups in Vault LDAP configuration
"""
        Method running the manage-ldap-groups function of LDAP module
        Manage groups in Vault LDAP configuration
        """
self