def main(): dev_conf = os.path.join(possible_topdir, 'etc', 'keystone.conf') config_files = None if os.path.exists(dev_conf): config_files = [dev_conf] cli.main(argv=sys.argv, config_files=config_files)
def test_cli(self): expected_msg = 'Config file not found, using default configs.' cli.main(argv=['keystone-manage', 'db_sync']) self.assertThat(self.logging.output, matchers.Contains(expected_msg))
cli.CMDS.append(TokenList) if __name__ == '__main__': dev_conf = os.path.join(possible_topdir, 'etc', 'keystone.conf') config_files = None if os.path.exists(dev_conf): config_files = [dev_conf] parser = argparse.ArgumentParser() parser.add_argument('-c', '--critical', type=int, default=10000, help='Critical value', action='store') parser.add_argument('-w', '--warning', type=int, default=1000, help='Warning value', action='store') args = vars(parser.parse_args()) watermark_warning = args['warning'] watermark_critical = args['critical'] # keystone-manage wants a command as a argv, so give it token_list cli.main(argv=[sys.argv[0], 'token_list'], config_files=config_files)
def main(): developer_config = os.path.join(possible_topdir, 'etc', 'keystone.conf') if not os.path.exists(developer_config): developer_config = None cli.main(argv=sys.argv, developer_config_file=developer_config)
@classmethod def main(cls): token_manager = token.persistence.PersistenceManager() token_manager.driver.list_tokens() cli.CMDS.append(TokenList) if __name__ == '__main__': dev_conf = os.path.join(possible_topdir, 'etc', 'keystone.conf') config_files = None if os.path.exists(dev_conf): config_files = [dev_conf] parser = argparse.ArgumentParser() parser.add_argument('-c', '--critical', type=int, default=10000, help='Critical value', action='store') parser.add_argument('-w', '--warning', type=int, default=1000, help='Warning value', action='store') args = vars(parser.parse_args()) watermark_warning = args['warning'] watermark_critical = args['critical'] # keystone-manage wants a command as a argv, so give it token_list cli.main(argv=[sys.argv[0],'token_list'], config_files=config_files)
print("expired tokens not being flushed." " current count: %s" % tokens) sys.exit(1) class TokenList(cli.BaseApp): """List tokens in the DB. This class is added to keystone-manage at runtime, and provides 'token_list' """ name = "token_list" @classmethod def main(cls): token_manager = token.persistence.PersistenceManager() token_manager.driver.list_tokens() cli.CMDS.append(TokenList) if __name__ == '__main__': environment.use_stdlib() dev_conf = os.path.join(possible_topdir, 'etc', 'keystone.conf') config_files = None if os.path.exists(dev_conf): config_files = [dev_conf] # keystone-manage wants a command as a argv, so give it token_list sys.argv.append('token_list') cli.main(argv=sys.argv, config_files=config_files)