예제 #1
0
 def define_request_operation(self, view_model, request, args):
     ''' setting request operation - enum and operation type - REST / NM '''
     if args.target and len(args.target) < 2 and not '--deploy' in request:
         args.target = args.target[0]
     view_model.target = args.target
     if '--status' in request:
         return self.define_status_operation(view_model, args)
     elif '--suspend' in request:
         return event.EventFactory(Operation.Server.SUSPEND)
     elif '--resume' in request:
         return event.EventFactory(Operation.Server.RESUME)
     elif '--start' in request:
         return self.define_start_operation(view_model, args)
     elif '--stop' in request:
         return self.define_stop_operation(view_model, args)
     elif '--restart' in request:
         return event.EventFactory(Operation.Server.RESTART)
     elif '--update' in request:
         return self.define_update_app(view_model, args)
     elif '--redeploy' in request:
         return self.define_redeploy_operation(view_model, args)
     elif '--show' in request:
         return self.define_show_operation(view_model, args)
     elif '--logs' in request:
         return self.define_logs_operation(view_model, args)
     elif '--admin_change' in request:
         return self.define_admin_operation(view_model, args)
     elif '--deploy' in request:
         return self.define_deploy_operation(view_model, args)
     elif '--undeploy' in request:
         return self.define_undeploy_operation(view_model, args)
     else:
         raise Exception("Not recognized operation.")
예제 #2
0
 def define_status_operation(self, view_model, args):
     ''' setting proper status operation - SERVERS or APPS '''
     if 'app' in args.target_type:
         view_model.deployment_name = \
         args.app_name if args.app_name is not None else args.lib_name
         return event.EventFactory(Operation.App.STATUS)
     return event.EventFactory(Operation.Server.STATUS)
예제 #3
0
 def define_undeploy_operation(self, view_model, args):
     ''' setting proper undeploy operation - LIB or APP '''
     view_model.target_type = TargetType.APP
     view_model.deployment_name = \
         args.app_name if args.app_name is not None else args.lib_name
     if args.lib_name:
         return event.EventFactory(Operation.Deployment.UNDEPLOY_LIB)
     return event.EventFactory(Operation.Deployment.UNDEPLOY_APP)
예제 #4
0
 def define_admin_operation(self, view_model, args):
     ''' setting proper admin operation - START or CANCEL or ACTIVATE '''
     if 'start' in args.target_type:
         return event.EventFactory(Operation.AdmChange.START_CHANGES)
     elif 'cancel' in args.target_type:
         return event.EventFactory(Operation.AdmChange.CANCEL_CHANGES)
     elif 'activate' in args.target_type:
         return event.EventFactory(Operation.AdmChange.ACTIVATE_CHANGES)
     raise Exception("Not recognized admin change type.")
예제 #5
0
 def define_show_operation(self, view_model, args):
     ''' setting proper show operation - APPS or LIBRARIES or TARGETS '''
     if 'apps' in args.target_type:
         return event.EventFactory(Operation.Show.APPS)
     elif 'libs' in args.target_type:
         return event.EventFactory(Operation.Show.LIBRARIES)
     elif 'targets' in args.target_type:
         return event.EventFactory(Operation.Show.TARGETS)
     elif 'jobs' in args.target_type:
         return event.EventFactory(Operation.Show.JOBS)
     raise Exception("Not recognized target type.")
예제 #6
0
 def define_logs_operation(self, view_model, args):
     ''' setting proper logs operation - HTTPACCESS 
     or DATASOURCE or DOMAIN or SERVER '''
     view_model.target_type = TargetType.SERVER
     if 'httpaccess' in args.target_type:
         return event.EventFactory(Operation.Logs.HTTP_ACCESS)
     elif 'datasource' in args.target_type:
         return event.EventFactory(Operation.Logs.DATASOURCE)
     elif 'server' in args.target_type:
         return event.EventFactory(Operation.Logs.SERVER)
     elif 'domain' in args.target_type:
         view_model.target = view_model.adminserver_name
         return event.EventFactory(Operation.Logs.DOMAIN)
     raise Exception("Not recognized logs type.")
예제 #7
0
 def define_uploaded_redeploy_operation(self, args, view_model):
     ''' setting proper uploaded deploy operation - APP or LIB '''
     if args.lib_name:
         return event.EventFactory(
             Operation.Deployment.REDEPLOY_UPLOADED_LIB)
     return event.EventFactory(Operation.Deployment.REDEPLOY_UPLOADED_APP)
예제 #8
0
 def define_local_redeploy_operation(self, args, view_model):
     ''' setting proper local deploy operation - APP or LIB '''
     if args.lib_name:
         return event.EventFactory(Operation.Deployment.REDEPLOY_LOCAL_LIB)
     return event.EventFactory(Operation.Deployment.REDEPLOY_LOCAL_APP)
예제 #9
0
 def define_update_app(self, view_model, args):
     view_model.target_type = TargetType.APP
     view_model.deployment_name = args.app_name
     return event.EventFactory(Operation.App.UPDATE)