示例#1
0
 def create(cls, service_args):
     try:
         conf = sys_util().get_sys_conf()
         service_manager = FactoryAgent().get_agent(conf['service_manager'])
         service = service_manager.create(service_args)
         checker = FactoryAgent().get_agent(conf['checker'])
         checker.check(service=service)
         db = DatabaseManager()
         db.persist(service)
     except Exception, msg:
         raise
 def create(cls, service_args):
     try:
         conf = sys_util().get_sys_conf()
         service_manager = FactoryAgent().get_agent(conf["service_manager"])
         service = service_manager.create(service_args)
         checker = FactoryAgent().get_agent(conf["checker"])
         checker.check(service=service)
         db = DatabaseManager()
         db.persist(service)
     except Exception, msg:
         raise
 def create(cls, secgroup_args):
     _sec_rules = secgroup_args.get("rules")
     _new_sec_rules = []
     for _sec_rule_args in _sec_rules:
         _new_sec_rule = Rule(**_sec_rule_args)
         _new_sec_rules.append(_new_sec_rule)
     new_secgroup = SecurityGroup(name=secgroup_args.get('name'), rules=_new_sec_rules)
     conf = sys_util().get_sys_conf()
     checker = FactoryAgent().get_agent(conf['checker'])
     checker.check(security_group=new_secgroup)
     db = DatabaseManager()
     db.persist(new_secgroup)
     return new_secgroup
示例#4
0
 def create(cls, secgroup_args):
     _sec_rules = secgroup_args.get("rules")
     _new_sec_rules = []
     for _sec_rule_args in _sec_rules:
         _new_sec_rule = Rule(**_sec_rule_args)
         _new_sec_rules.append(_new_sec_rule)
     new_secgroup = SecurityGroup(name=secgroup_args.get('name'),
                                  rules=_new_sec_rules)
     conf = sys_util().get_sys_conf()
     checker = FactoryAgent().get_agent(conf['checker'])
     checker.check(security_group=new_secgroup)
     db = DatabaseManager()
     db.persist(new_secgroup)
     return new_secgroup