Beispiel #1
0
    def get(self, search_term):
        result = common.getSearchHosts(search_term)
        if result:
            data = {"hosts": [host["hostname"] for host in result]}
        else:
            data = {"hosts": ""}

        return data
Beispiel #2
0
    def get(self, search_term):
        result = common.getSearchHosts(search_term)
        if result:
            data = {"hosts": [host["hostname"] for host in result]}
        else:
            data = {"hosts": ""}

        return data
Beispiel #3
0
    def post(self):
        args = parser.parse_args()
        hostname = args['hostname']
        ansiblevars = args['vars']
        groups = args['groups']
        exists = [str(item) for item in common.getSearchHosts(hostname)]
        if exists:
            return 'Host already exists', 201

        add_host(hostname, ansiblevars)
        add_host_togroups(hostname, groups)

        return '', 200
Beispiel #4
0
    def post(self):
        args = parser.parse_args()
        hostname = args['hostname']
        ansiblevars = args['vars']
        groups = args['groups']
        exists = [str(item) for item in common.getSearchHosts(hostname)]
        if exists:
            return 'Host already exists', 201

        add_host(hostname, ansiblevars)
        add_host_togroups(hostname, groups)

        return '', 200