2 # -*- coding: utf-8 -*-
3 # Licensed under the Apache License, Version 2.0 (the "License"); you may
4 # not use this file except in compliance with the License. You may obtain
5 # a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 # License for the specific language governing permissions and limitations
16 # @author: David Blaisonneau <david.blaisonneau@orange.com>
17 # @author: Arnaud Morin <arnaud1.morin@orange.com>
19 from opensteak.foreman_objects.item import ForemanItem
22 class ItemHostsGroup(ForemanItem):
25 Represent the content of a foreman hostgroup as a dict
28 objName = 'hostgroups'
29 payloadObj = 'hostgroup'
31 def __init__(self, api, key, *args, **kwargs):
33 Represent the content of a foreman object as a dict
35 @param api: The foreman api
36 @param key: The object Key
37 @param *args, **kwargs: the dict representation
38 @return RETURN: Itself
40 ForemanItem.__init__(self, api, key,
41 self.objName, self.payloadObj,
43 self.update({'puppetclass_ids':
44 self.api.list('{}/{}/puppetclass_ids'
45 .format(self.objName, key))})
46 self.update({'param_ids':
47 list(self.api.list('{}/{}/parameters'
48 .format(self.objName, key),