from .xlate import XLATOR
-__version__ = '0.4.8'
+__version__ = '0.4.9'
LOG = logging.getLogger(__name__)
args.append('--management')
args.append('true')
- cmd_str = 'cobbler ' + ' '.join(map(lambda x: pipes.quote(x), args))
- LOG.debug("Should execute: {}".format(cmd_str))
- if self.verbose > 1:
- LOG.debug(_("Cobbler arguments for creating a new system:") + "\n" + pp(args))
-
proc = self.exec_cobbler(args)
if proc.returncode:
rc=proc.returncode, err=err)
raise ExpectedCobblerError(msg)
+ self.sync()
+
+ # -------------------------------------------------------------------------
+ def sync(self):
+ """Executing 'cobbler sync' to apply environment, especially DHCPD configuration."""
+
+ proc = self.exec_cobbler('sync')
+
+ if proc.returncode != 0:
+ err = _('No error message')
+ if proc.stderr:
+ err = proc.stderr
+ elif proc.stdout:
+ err = proc.stdout
+ msg = _("Could syncing cobbler: {}").format(err)
+ raise ExpectedCobblerError(msg)
+
+ if self.verbose > 1:
+ if proc.stdout:
+ LOG.debug(_("Output on {}:").format('STDOUT') + '\n' + proc.stdout)
+ if self.verbose:
+ if proc.stderr:
+ LOG.debug(_("Output on {}:").format('STDERR') + '\n' + proc.stderr)
+
+
# =============================================================================
if __name__ == "__main__":