def show_server(self, server_name): """ Show a server, by name """ self._begin_op() server_sm = find_server_byname(self.db_session, server_name) return self._show_server(server_sm)
def reset_server(self, server_name): """ Reset server SM """ self._begin_op() db_session = self.db_session server_sm = find_server_byname(db_session, server_name) exec_server_sm(server_sm, ServerSMReset) self._finish_op()
def disable_server(self, server_name): """ Disable a server """ self._begin_op() db_session = self.db_session server_sm = find_server_byname(db_session, server_name) exec_server_sm(server_sm, ServerSMDisable) self._finish_op()
def rsync_server_admin_config(self, server_name, no_rndc=False): """ Rsync configuration files to a server, and rndc reconfig it """ self._begin_op() db_session = self.db_session server_sm = find_server_byname(db_session, server_name) config_dir = (settings['server_admin_config_dir'] + '/' + server_sm.server_type) cmdline = (settings['rsync_path'] + ' ' + settings['rsync_args'] + ' --password-file ' + settings['rsync_password_file'] + ' ' + config_dir + '/' + ' ' + settings['rsync_target']) # Add IPv6 address squares address_string = '[' + server_sm.address + ']' \ if server_sm.address.find(':') else server_sm.address cmdline_str = cmdline % address_string cmdline = cmdline_str.split(' ') output = check_call(cmdline) if not no_rndc: cmdline = [settings['rndc_path'], '-s', server_sm.name, 'reconfig'] output = check_call(cmdline) self._finish_op()