def delete_config(self, ip=None):
     """
     Deletes a configuration file
     """
     if self.filesystem is False:
         key = self.config_path
         if Configuration.exists(key, raw=True):
             Configuration.delete(key, raw=True)
     else:
         client = self._load_client(ip)
         client.file_delete(self.config_path)
예제 #2
0
 def unregister_service(node_name, service_name):
     """
     Un-register the metadata of a service from the configuration management
     :param node_name: Unused
     :type node_name: str
     :param service_name: Name of the service to clean from the configuration management
     :type service_name: str
     :return: None
     """
     _ = node_name
     with open(Toolbox.BOOTSTRAP_FILE, 'r') as bs_file:
         node_id = json.load(bs_file)['node_id']
         Configuration.delete(key='/ovs/alba/asdnodes/{0}/services/{1}'.format(node_id, Toolbox.remove_prefix(service_name, 'ovs-')))
예제 #3
0
 def remove_asd(asd_id, mountpoint):
     """
     Removes an ASD
     :param asd_id: ASD identifier
     :type asd_id: str
     :param mountpoint: Mountpoint of the ASDs disk
     :type mountpoint: str
     :return: None
     """
     service_name = ASDController.ASD_SERVICE_PREFIX.format(asd_id)
     if ServiceManager.has_service(service_name, ASDController._local_client):
         ServiceManager.stop_service(service_name, ASDController._local_client)
         ServiceManager.remove_service(service_name, ASDController._local_client)
     try:
         ASDController._local_client.dir_delete('{0}/{1}'.format(mountpoint, asd_id))
     except Exception as ex:
         ASDController._logger.warning('Could not clean ASD data: {0}'.format(ex))
     Configuration.delete(ASDController.ASD_CONFIG_ROOT.format(asd_id), raw=True)