def init(kubeb, name, user, template, local, image, env, force): """ Init kubeb configuration Generate config, script files Generate Docker stuff if use --local option """ if file_util.config_file_exist() and force is False: kubeb.log( 'Kubeb config found. Please update config file or use --force option' ) return if (not file_util.template_exist(template)): kubeb.log('Kubeb template not found. Please check template name') return ext_template = file_util.is_ext_template(template) file_util.generate_config_file(name, user, template, ext_template, image, local, env) file_util.generate_script_file(name, template) file_util.generate_environment_file(env, template) if local: file_util.generate_docker_file(template) kubeb.log('Kubeb config file generated in %s', click.format_filename(file_util.config_file))
def execute(self): file_util.clean_up() file_util.generate_config_file(self.data["name"], self.data["user"], self.data["template"], self.data["ext_template"], self.data["image"], self.data["env"]) file_util.generate_environment_file(self.data["env"], self.data["template"]) file_util.generate_docker_file(self.data["template"])
def env(self, env): if not file_util.config_file_exist(): self.log('Kubeb config file not found in %s', file_util.kubeb_directory) return environment = config.get_env(env) if not environment: self.log('Environment not found') self.log('Initiate environment %s in %s', env, file_util.kubeb_directory) file_util.generate_environment_file(env, config.get_template()) config.set_current_environement(env) self.log('Now use %s', env)
def env(kubeb, env): """Use environment Example: kubeb env develop to use environment develop """ if not file_util.config_file_exist(): kubeb.log('Kubeb config file not found in %s', file_util.kubeb_directory) return environment = config.get_env(env) if not environment: kubeb.log('Environment not found') kubeb.log('Initiate environment %s in %s', env, file_util.kubeb_directory) file_util.generate_environment_file(env, config.get_template()) config.set_current_environement(env) kubeb.log('Now use %s', env)