示例#1
0
    def process(self):
        """Main processing function."""
        try:
            configFile = os.path.join(self.util_install_path,
                                      "cortx/utils/conf",
                                      "openldap_config.yaml")
            oldSampleFile = os.path.join(self.utils_tmp_dir,
                                         "openldap_config.yaml.sample.old")
            newSampleFile = os.path.join(self.util_install_path,
                                         "cortx/utils/conf",
                                         "openldap_config.yaml.sample")
            unsafeAttributesFile = os.path.join(
                self.util_install_path, "cortx/utils/conf",
                "openldap_config_unsafe_attributes.yaml")
            fileType = 'yaml://'
            # Upgrade config files
            Log.info("merge config started")
            self.merge_config(configFile, oldSampleFile, newSampleFile,
                              unsafeAttributesFile, fileType)
            Log.info("merge config completed")

            # Remove temporary .old files from temporary location
            Log.info("Remove sample.old file started")
            if os.path.isfile(oldSampleFile):
                os.remove(oldSampleFile)
            Log.info("Remove sample.old file completed")

        except Exception as e:
            raise OpenldapPROVError(f'exception: {e}')
示例#2
0
 def __init__(self, config: str):
     """Constructor."""
     try:
         super(ResetCmd, self).__init__(config)
     except Exception as e:
         Log.debug("Initializing reset phase failed")
         raise OpenldapPROVError(f'exception: {e}')
示例#3
0
 def process(self):
   """Main processing function."""
   try:
       Log.info("Backup .sample to .old started")
       self.backup_sample_file()
       Log.info("Backup .sample to .old completed")
   except Exception as e:
     raise OpenldapPROVError(f'exception: {e}')
示例#4
0
 def process(self):
     """Main processing function."""
     try:
         self.delete_replication_config()
         self.delete_log_files()
         BaseConfig.cleanup(True)
         os.system('systemctl restart slapd')
     except Exception as e:
         raise OpenldapPROVError(f'exception: {e}\n')
示例#5
0
 def __init__(self, config: str):
     """Constructor."""
     try:
         super(ConfigCmd, self).__init__(config)
         Log.debug(
             "Inside config phaze, reading credentials from input file")
         self.update_cluster_id()
         self.update_ldap_credentials()
         self.read_ldap_credentials()
     except Exception as e:
         raise OpenldapPROVError(f'exception: {e}\n')
示例#6
0
 def __init__(self, config: str):
     try:
         super(Test, self).__init__(config)
         self.update_ldap_credentials()
         self.read_ldap_credentials()
     except Exception as e:
         raise OpenldapPROVError(f'exception: {e}\n')
     passwd = self.rootdn_passwd.decode("utf-8")
     Log.init('OpenldapProvisioning', '/var/log/cortx/utils/openldap', level='DEBUG')
     self.test_base_dn(passwd)
     if self.test_openldap_replication() > 1:
         self.test_olcsyncrepl(passwd)
         self.test_olcserverId(passwd)
示例#7
0
    def process(self):
        """Main processing function."""
        try:
            self.delete_replication_config()
            self.delete_log_files()
            BaseConfig.cleanup(True)
            # restart slapd
            if (os.system('kill -15 $(pidof slapd)') != 0):
                Log.error('failed to kill slapd process while cleanup')
                quit()
            if (os.system('/usr/sbin/slapd -u ldap -h \'ldapi:/// ldap:///\'')
                    != 0):
                Log.error('failed to start slapd in cleanup')
                quit()

        except Exception as e:
            raise OpenldapPROVError(f'exception: {e}\n')
示例#8
0
    def process(self):
        """Main processing function."""
        try:
            self.delete_replication_config()
            self.delete_log_files()
            install_dir = self.get_confvalue(
                self.get_confkey('CONFIG>OPENLDAP_INSTALL_DIR'))
            data_dir = self.get_confvalue(
                self.get_confkey('CONFIG>OPENLDAP_DATA_DIR'))
            BaseConfig.cleanup(True, install_dir, data_dir)
            # restart slapd
            if (os.system('kill -15 $(pidof slapd)') != 0):
                Log.error('failed to kill slapd process while cleanup')
                quit()
            if (os.system('/usr/sbin/slapd -F ' + install_dir +
                          '/openldap/slapd.d -u ldap -h \'ldapi:/// ldap:///\''
                          ) != 0):
                Log.error('failed to start slapd in cleanup')
                quit()

        except Exception as e:
            raise OpenldapPROVError(f'exception: {e}\n')
示例#9
0
 def process(self):
     """Main processing function."""
     try:
         self.configure_openldap()
     except Exception as e:
         raise OpenldapPROVError(f'exception: {e}\n')
示例#10
0
 def process(self):
     """Main processing function."""
     try:
         self.delete_log_files()
     except Exception as e:
         raise OpenldapPROVError(f'exception: {e}\n')
示例#11
0
 def __init__(self):
   """Constructor."""
   try:
     super(PreUpgradeCmd, self).__init__(None)
   except Exception as e:
     raise OpenldapPROVError(f'exception: {e}')