Ejemplo n.º 1
0
 def get(self):
     result = common.getAllGroups()
     if result:
         data = {"groups": [group for group in result]}
     else:
         data = {"groups": ""}
     return data
Ejemplo n.º 2
0
Archivo: api.py Proyecto: 40a/jetfire
 def get(self):
     result = common.getAllGroups()
     if result:
         data = {"groups": [group for group in result]}
     else:
         data = {"groups": ""}
     return data
Ejemplo n.º 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)
Ejemplo n.º 4
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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 7
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
Ejemplo n.º 8
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
Ejemplo n.º 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
Ejemplo n.º 10
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)
Ejemplo n.º 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
Ejemplo n.º 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)
Ejemplo n.º 13
0
 def get(self):
     groups = common.getAllGroups()
     # return everything to the template
     return flask.render_template("addhost.html", groups=groups)
Ejemplo n.º 14
0
 def get(self):
     groups = common.getAllGroups()
     # return everything to the template
     return flask.render_template('addhost.html', groups=groups)
Ejemplo n.º 15
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)