def get(self): result = common.getAllGroups() if result: data = {"groups": [group for group in result]} else: data = {"groups": ""} return data
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)
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
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
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
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
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)
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
def get(self): groups = common.getAllGroups() # return everything to the template return flask.render_template("addhost.html", groups=groups)
def get(self): groups = common.getAllGroups() # return everything to the template return flask.render_template('addhost.html', groups=groups)