def pai_service(): if len(sys.argv) < 2: pai_service_info() return option = sys.argv[1] del sys.argv[1] if option not in ["start", "delete", "stop", "refresh"]: pai_service_info() return parser = argparse.ArgumentParser() parser.add_argument('-p', '--config-path', dest="config_path", required=True, help="The path of your configuration directory.") parser.add_argument('-n', '--service-name', dest="service_name", default='all', help="Build and push the target image to the registry") args = parser.parse_args(sys.argv[1:]) config_path = args.config_path service_name = args.service_name cluster_object_model = cluster_object_model_generate_service(config_path) cluster_object_model_k8s = cluster_object_model_generate_k8s(config_path) service_list = None if service_name != "all": service_list = [service_name] # Tricky , re-install kubectl first. # TODO: install kubectl-install here. if kubectl_env_checking(cluster_object_model_k8s) == False: return if option == "start": service_management_starter = service_management_start.serivce_management_start( cluster_object_model, service_list) service_management_starter.run() if option == "delete": service_management_deleter = service_management_delete.service_management_delete( cluster_object_model, service_list) service_management_deleter.run() if option == "stop": service_management_stopper = service_management_stop.service_management_stop( cluster_object_model, service_list) service_management_stopper.run() if option == "refresh": service_management_refresher = service_management_refresh.service_management_refresh( cluster_object_model, service_list) service_management_refresher.run()
def service_stop(self, args): cluster_object_model, service_list = self.process_args(args) service_management_stopper = service_management_stop.service_management_stop( cluster_object_model, service_list) service_management_stopper.run()
def service_stop(self, args): service_list = self.process_args(args) service_management_stopper = service_management_stop.service_management_stop( args.kube_config_path, service_list) service_management_stopper.run()