def modify_config(self, key, value): """ Modifies one value in the config file """ cr_config = Config() array_key = key.split(":") try: Config.set_config_value(array_key[0], array_key[1], value) except Exception as e: print (e.message) return False try: cr_config.write_config_file() except Exception as e: print (e.message) return False return True
def modify_config(self, key, value): """ Modifies one value in the config file """ cr_config = Config() array_key = key.split(':') try: Config.set_config_value(array_key[0], array_key[1], value) except Exception as e: print(e.message) return False try: cr_config.write_config_file() except Exception as e: print(e.message) return False return True
exit(3) log.log_info('CLI Manager is starting...') cr_config = Config() cr_config.read_config_file() if len(sys.argv) == 1: cr.cli.init_screen() main_screen = MainCli() main_screen.display() else: if sys.argv[1] == 'wizard': cr.cli.init_screen() wizard_screen = WizardCli() wizard_screen.display() else: print 'CentralReport CLI Manager - Usage: \n' \ 'manager.py [wizard]' exit(1) print 'Saving the new configuration...' cr_config.write_config_file() # CentralReport must be restarted to detect the new configuration if int(system.execute_command('/usr/local/bin/centralreport pid')) != 0: print 'Restarting the CentralReport daemon...' system.execute_command('/usr/local/bin/centralreport restart') exit(0)