Exemple #1
0
 def post(self, *args):
     if args[0]:
         name = args[0]
         group = Groups(name)
         for key, value in self.request.arguments.iteritems():
             if key in ("repo_addr", "repo_user", "repo_passwd"):
                 setattr(group, key, value[0])
         group.save()
     else:
         group = Groups(self.get_argument('name'))
         group.repo_addr = self.get_argument('repo_addr')
         group.repo_user = self.get_argument('repo_user')
         group.repo_passwd = self.get_argument('repo_passwd')
         group.save()
Exemple #2
0
 def post(self, *args):
     try:
         if len(args) > 0:
             name = args[0]
             group = Groups(name)
             for key, value in self.request.arguments.iteritems():
                 if key in ("repo_addr", "repo_user", "repo_passwd"):
                     setattr(group, key, value[0])
             group.save()
         else:
             group = Groups(self.get_argument("name"))
             group.repo_addr = self.get_argument("repo_addr")
             group.repo_user = self.get_argument("repo_user")
             group.repo_passwd = self.get_argument("repo_passwd")
             group.save()
         self.write(cyclone.escape.json_encode({"status": "ok"}))
     except Exception, e:
         self.write(cyclone.escape.json_encode({"status": "fail", "error": str(e)}))
Exemple #3
0
 def post(self, *args):
     try:
         if len(args) > 0:
             name = args[0]
             group = Groups(name)
             for key, value in self.request.arguments.iteritems():
                 if key in ("repo_addr", "repo_user", "repo_passwd"):
                     setattr(group, key, value[0])
             group.save()
         else:
             group = Groups(self.get_argument('name'))
             group.repo_addr = self.get_argument('repo_addr')
             group.repo_user = self.get_argument('repo_user')
             group.repo_passwd = self.get_argument('repo_passwd')
             group.save()
         self.write(cyclone.escape.json_encode({'status': 'ok'}))
     except Exception, e:
         self.write(cyclone.escape.json_encode({'status': 'fail', 'error': str(e)}))
Exemple #4
0
class Platform(PlatformBase):
    def __init__(self, platform_name, nodes):
        self.system_settings = nodes.system_settings
        self._nodes = nodes

        if platform_name in PLATFORM_NAMING_CONVENTIONS:
            name = PLATFORM_NAMING_CONVENTIONS[platform_name]
        else:
            name = str(platform_name) + ' Platform'

        super(Platform, self).__init__(name, platform_name, 'platforms')

        groups_db_file = None
        error_db_file = None
        if platform_name != 'virgins':
            db_path = os.path.join('platforms', platform_name)
            groups_db_file = os.path.join(db_path, 'groups.db')
            error_db_file = os.path.join(db_path, 'default_error.db')

        LOGGER.debug("Creating Default Groups")

        default_groups = OrderedDict()
        default_groups['inactive_group'] = Group('Inactive Group',
                                                 platform_name, self._nodes)

        self.groups = Groups(self._nodes,
                             platform_name,
                             db_file=groups_db_file,
                             defaults=default_groups)

        self.error = NodeError(system_settings=self.system_settings,
                               db_file=error_db_file)

    def save(self, db_content=None):
        """ Overloading default save method """
        self.groups.save()
        super(Platform, self).save()

    def delete(self):
        """ Overloading default delete method """
        self.groups.delete()
        super(Platform, self).delete()
Exemple #5
0
 def post(self, *args):
     try:
         if len(args) > 0:
             name = args[0]
             group = Groups(name)
             for key, value in self.request.arguments.iteritems():
                 if key in ("repo_addr", "repo_user", "repo_passwd"):
                     setattr(group, key, value[0])
             group.save()
         else:
             group = Groups(self.get_argument('name'))
             group.repo_addr = self.get_argument('repo_addr')
             group.repo_user = self.get_argument('repo_user')
             group.repo_passwd = self.get_argument('repo_passwd')
             group.save()
         self.write(cyclone.escape.json_encode({'status': 'ok'}))
     except Exception, e:
         self.write(
             cyclone.escape.json_encode({
                 'status': 'fail',
                 'error': str(e)
             }))