def create_periodic_check(self, container): container_raw = container.attrs env = container_raw["Config"]["Env"] check_props = parse_env(env, 'HEALTH_CHECK_', '=') if not check_props: raise CheckConfigurationException() # period is in time format such as 30s, 1m, 2hr # interval is period converted to integer, # representing the value of period in seconds period = check_props.pop('interval', '5s') interval = parse_period(period) self.scheduler.add_job( func=self.execute_check, args=[check_props, container.id], id=container.id, trigger='interval', seconds=interval, next_run_time=datetime.now() )
print('This have to be called with 1 argument, which is the action') print() print('Possible values are:') print('- install: Install dependencies and configure system') print('- environment: Setup the environment') if __name__ == '__main__': # Load PHP configuration from `tsuru.yml` config = load_configuration() # Create an application object from environ application = { 'directory': '/home/application/current', 'user': '******', 'source_directory': '/var/lib/tsuru', 'env': parse_env(config) } # Get the application manager manager = Manager(config, application) # Run installation & configuration if len(sys.argv) <= 1: print_help() elif sys.argv[1] == 'install': manager.install() manager.configure() elif sys.argv[1] == 'environment': manager.setup_environment() else: print('Action "%s" not found\n' % sys.argv[1])
print() print('Possible values are:') print('- install: Install dependencies and configure system') print('- environment: Setup the environment') if __name__ == '__main__': # Load PHP configuration from `tsuru.yml` config = load_configuration() # Create an application object from environ application = { 'directory': '/home/application/current', 'user': '******', 'source_directory': '/var/lib/tsuru', 'env': parse_env(config) } # Get the application manager manager = Manager(config, application) # Run installation & configuration if len(sys.argv) <= 1: print_help() elif sys.argv[1] == 'install': manager.install() manager.configure() elif sys.argv[1] == 'environment': manager.setup_environment() else: print('Action "%s" not found\n' % sys.argv[1])
def __init__(self, file): self.env = utils.parse_env(file)