def _save_answers(self, name):
     self.logger.info(
         _("Generating answer file '{name}'").format(name=name, ))
     path = self.resolveFile(name)
     with open(path, 'w') as f:
         f.write('[environment:default]\n')
         for c in ohostedcons.__dict__['__hosted_attrs__']:
             for k in c.__dict__.values():
                 if hasattr(k, '__hosted_attrs__'):
                     if k.__hosted_attrs__['answerfile']:
                         k = k.fget(None)
                         if k in self.environment:
                             v = self.environment[k]
                             f.write('%s=%s:%s\n' % (
                                 k,
                                 common.typeName(v),
                                 '\n'.join(v) if isinstance(v, list) else v,
                             ))
     if self.environment[ohostedcons.CoreEnv.NODE_SETUP]:
         try:
             ohostedutil.persist(path)
         except Exception as e:
             self.logger.debug(
                 'Error persisting {path}'.format(path=path, ),
                 exc_info=True,
             )
             self.logger.error(e)
 def _save_answers(self, name):
     self.logger.info(_("Generating answer file '{name}'").format(name=name))
     path = self.resolveFile(name)
     with open(path, "w") as f:
         self._generate_answers(f)
     if self.environment[ohostedcons.CoreEnv.NODE_SETUP]:
         try:
             ohostedutil.persist(path)
         except Exception as e:
             self.logger.debug("Error persisting {path}".format(path=path), exc_info=True)
             self.logger.error(e)
 def _save_answers(self, name):
     self.logger.info(
         _("Generating answer file '{name}'").format(name=name, ))
     path = self.resolveFile(name)
     with open(path, 'w') as f:
         self._generate_answers(f)
     if self.environment[ohostedcons.CoreEnv.NODE_SETUP]:
         try:
             ohostedutil.persist(path)
         except Exception as e:
             self.logger.debug(
                 'Error persisting {path}'.format(path=path, ),
                 exc_info=True,
             )
             self.logger.error(e)
 def _persist_files_start(self):
     # Using two stages here because some files can be written out of
     # transactions
     self.logger.debug('Saving persisting file configuration')
     for path in self.environment[otopicons.CoreEnv.MODIFIED_FILES] + [
             self.environment[otopicons.CoreEnv.LOG_DIR],
     ]:
         try:
             ohostedutil.persist(path)
         except Exception as e:
             self.logger.debug(
                 'Error persisting {path}'.format(path=path, ),
                 exc_info=True,
             )
             self.logger.error(e)
Example #5
0
 def _persist_files_start(self):
     self.logger.debug('Saving persisting PKI configuration')
     for path in (
             ohostedcons.FileLocations.VDSMCERT,
             ohostedcons.FileLocations.LIBVIRT_SPICE_SERVER_CERT,
     ):
         try:
             if os.path.exists(path):
                 # here we need the whole directory to be persisted
                 ohostedutil.persist(os.path.dirname(path))
         except Exception as e:
             self.logger.debug(
                 'Error persisting {path}'.format(path=path, ),
                 exc_info=True,
             )
             self.logger.error(e)
 def _persist_files_start(self):
     self.logger.debug('Saving persisting PKI configuration')
     for path in (
         ohostedcons.FileLocations.VDSMCERT,
         ohostedcons.FileLocations.LIBVIRT_SPICE_SERVER_CERT,
     ):
         try:
             if os.path.exists(path):
                 # here we need the whole directory to be persisted
                 ohostedutil.persist(os.path.dirname(path))
         except Exception as e:
             self.logger.debug(
                 'Error persisting {path}'.format(
                     path=path,
                 ),
                 exc_info=True,
             )
             self.logger.error(e)
 def _persist_files_start(self):
     # Using two stages here because some files can be written out of
     # transactions
     self.logger.debug('Saving persisting file configuration')
     for path in self.environment[
         otopicons.CoreEnv.MODIFIED_FILES
     ] + [
         self.environment[otopicons.CoreEnv.LOG_DIR],
     ]:
         try:
             ohostedutil.persist(path)
         except Exception as e:
             self.logger.debug(
                 'Error persisting {path}'.format(
                     path=path,
                 ),
                 exc_info=True,
             )
             self.logger.error(e)