示例#1
0
 def get(self):
     result = common.getAllGroups()
     if result:
         data = {"groups": [group for group in result]}
     else:
         data = {"groups": ""}
     return data
示例#2
0
文件: api.py 项目: 40a/jetfire
 def get(self):
     result = common.getAllGroups()
     if result:
         data = {"groups": [group for group in result]}
     else:
         data = {"groups": ""}
     return data
示例#3
0
 def get(self):
     '''logic to return a list of all available ansible hosts'''
     hosts = common.getAllHosts()
     childgroups = common.getAllGroups()
     return flask.render_template('addgroup.html',
                                  hosts=hosts,
                                  childgroups=childgroups)
示例#4
0
文件: edit_group.py 项目: 40a/jetfire
 def get_availablechildren(self):
     allgroups = common.getAllGroups()
     # build compared list
     groupname = str(flask.request.form['group_get'])
     childgroups = self.get_childgroups(groupname)
     s = set(childgroups)
     availablechildgroups = [x for x in allgroups if x not in s]
     return availablechildgroups
示例#5
0
 def get_availablechildren(self):
     allgroups = common.getAllGroups()
     # build compared list
     groupname = str(flask.request.form['group_get'])
     childgroups = self.get_childgroups(groupname)
     s = set(childgroups)
     availablechildgroups = [x for x in allgroups if x not in s]
     return availablechildgroups
示例#6
0
 def get_availablegroups(self):
     ''' return all groups this host is not a member of'''
     allgroups = common.getAllGroups()
     # build compared list
     hostname = str(flask.request.form['p_get'])
     groups = self.get_hostgroups(hostname)
     s = set(groups)
     availablegroups = [x for x in allgroups if x not in s]
     return availablegroups
示例#7
0
文件: edit_host.py 项目: 40a/jetfire
 def get_availablegroups(self):
     ''' return all groups this host is not a member of'''
     allgroups = common.getAllGroups()
     # build compared list
     hostname = str(flask.request.form['p_get'])
     groups = self.get_hostgroups(hostname)
     s = set(groups)
     availablegroups = [ x for x in allgroups if x not in s ]
     return availablegroups
示例#8
0
文件: get_group.py 项目: 40a/jetfire
    def get_allgroups(self):
        result = common.getAllGroups()
        allgroups = []

        group = GetGroup()
        for item in result:
            t = {}
            t["groupname"] = str(item)
            t["children"] = group.get_groupchildren(item)
            t["hosts"] = group.get_grouphosts(item)
            allgroups.append(t)

        return allgroups
示例#9
0
    def get_allgroups(self):
        result = common.getAllGroups()
        allgroups = []

        group = GetGroup()
        for item in result:
            t = {}
            t["groupname"] = str(item)
            t["children"] = group.get_groupchildren(item)
            t["hosts"] = group.get_grouphosts(item)
            allgroups.append(t)

        return allgroups
示例#10
0
文件: add_group.py 项目: 40a/jetfire
 def post(self):
     groupname = str(flask.request.form['add_group'])
     hosts = common.getAllHosts()
     childgroups = common.getAllGroups()
     if len(groupname) == 0:
         flask.flash('empty groupname')
         return flask.render_template('addgroup.html', hosts=hosts, childgroups=childgroups)
     elif groupname == self.get_groupname(groupname):
         flask.flash('groupname already exists')
         return flask.render_template('addgroup.html', hosts=hosts, childgroups=childgroups)
     else:
         # insert logic to see if group already exists (get_groupname)
         self.add_group(groupname)
         flask.flash('Group added successfully')
         return flask.render_template('addgroup.html', hosts=hosts, childgroups=childgroups)
示例#11
0
 def get(self):
     result = {}
     allHosts = [host for host in common.getAllHosts()]
     result["all"] = allHosts
     allGroups = common.getAllGroups()
     for item1 in allGroups:
         items = common.db.groups.find({"groupname": item1}, {"_id": 0})
         for item in items:
             groupname = str(item["groupname"])
             groupitems = common.db.groups.find({"groupname": groupname}, {
                 "_id": 0,
                 "groupname": 0
             })
             for var in groupitems:
                 if not var['vars']:
                     var['vars'] = {}
                 result[groupname] = var
     return result
示例#12
0
 def post(self):
     groupname = str(flask.request.form['add_group'])
     hosts = common.getAllHosts()
     childgroups = common.getAllGroups()
     if len(groupname) == 0:
         flask.flash('empty groupname')
         return flask.render_template('addgroup.html',
                                      hosts=hosts,
                                      childgroups=childgroups)
     elif groupname == self.get_groupname(groupname):
         flask.flash('groupname already exists')
         return flask.render_template('addgroup.html',
                                      hosts=hosts,
                                      childgroups=childgroups)
     else:
         # insert logic to see if group already exists (get_groupname)
         self.add_group(groupname)
         flask.flash('Group added successfully')
         return flask.render_template('addgroup.html',
                                      hosts=hosts,
                                      childgroups=childgroups)
示例#13
0
 def get(self):
     groups = common.getAllGroups()
     # return everything to the template
     return flask.render_template("addhost.html", groups=groups)
示例#14
0
 def get(self):
     groups = common.getAllGroups()
     # return everything to the template
     return flask.render_template('addhost.html', groups=groups)
示例#15
0
文件: add_group.py 项目: 40a/jetfire
 def get(self):
     '''logic to return a list of all available ansible hosts'''
     hosts = common.getAllHosts()
     childgroups = common.getAllGroups()
     return flask.render_template('addgroup.html', hosts=hosts, childgroups=childgroups)