def _config_service(self, mgmt_ip_address, service, config): user = cfg.CONF.openwrt.user password = cfg.CONF.openwrt.password package = service if service == "dhcp": package = "dnsmasq" try: cmd = "uci import %s; /etc/init.d/%s restart" % (service, package) LOG.debug( 'execute command: %(cmd)s on mgmt_ip_address ' '%(mgmt_ip)s', { 'cmd': cmd, 'mgmt_ip': mgmt_ip_address }) commander = cmd_executer.RemoteCommandExecutor( user, password, mgmt_ip_address) commander.execute_command(cmd, input_data=config) except Exception as ex: LOG.error( "While executing command on remote " "%(mgmt_ip)s: %(exception)s", { 'mgmt_ip': mgmt_ip_address, 'exception': ex }) raise exceptions.MgmtDriverException()
def _config_service(self, mgmt_ip_address, service, config): user = cfg.CONF.openwrt.user password = cfg.CONF.openwrt.password try: cmd = "uci import %s; /etc/init.d/%s restart" % (service, service) LOG.debug(_('execute command: %s'), (cmd)) commander = cmd_executer.RemoteCommandExecutor( user, password, mgmt_ip_address) commander.execute_command(cmd, input_data=config) except Exception as ex: LOG.error(_("While executing command on remote: %s"), ex) raise exceptions.MgmtDriverException()