Fixed custom fields loading
Change-Id: I3677da2f101cffcae46517ac41393e57284123b7
This commit is contained in:
parent
55e4cb9962
commit
afd68d0c77
@ -11,7 +11,6 @@
|
|||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
import json
|
|
||||||
|
|
||||||
from surveilclient.common import surveil_manager
|
from surveilclient.common import surveil_manager
|
||||||
|
|
||||||
@ -28,10 +27,6 @@ class HostsManager(surveil_manager.SurveilManager):
|
|||||||
|
|
||||||
def create(self, **kwargs):
|
def create(self, **kwargs):
|
||||||
"""Create a new host."""
|
"""Create a new host."""
|
||||||
|
|
||||||
if "custom_fields" in kwargs:
|
|
||||||
kwargs["custom_fields"] = json.loads(kwargs["custom_fields"])
|
|
||||||
|
|
||||||
resp, body = self.http_client.json_request(
|
resp, body = self.http_client.json_request(
|
||||||
HostsManager.base_url, 'POST',
|
HostsManager.base_url, 'POST',
|
||||||
body=kwargs
|
body=kwargs
|
||||||
@ -50,9 +45,6 @@ class HostsManager(surveil_manager.SurveilManager):
|
|||||||
"""Update a host."""
|
"""Update a host."""
|
||||||
kwargs["host_name"] = host_name
|
kwargs["host_name"] = host_name
|
||||||
|
|
||||||
if "custom_fields" in kwargs:
|
|
||||||
kwargs["custom_fields"] = json.loads(kwargs["custom_fields"])
|
|
||||||
|
|
||||||
resp, body = self.http_client.json_request(
|
resp, body = self.http_client.json_request(
|
||||||
HostsManager.base_url + '/' + host_name, 'PUT',
|
HostsManager.base_url + '/' + host_name, 'PUT',
|
||||||
body=kwargs
|
body=kwargs
|
||||||
|
@ -12,6 +12,8 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import json
|
||||||
|
|
||||||
from surveilclient.common import utils
|
from surveilclient.common import utils
|
||||||
from surveilclient.openstack.common import cliutils
|
from surveilclient.openstack.common import cliutils
|
||||||
|
|
||||||
@ -67,6 +69,10 @@ def do_config_host_update(sc, args):
|
|||||||
'notification_period',
|
'notification_period',
|
||||||
'use']
|
'use']
|
||||||
host = _dict_from_args(args, arg_names)
|
host = _dict_from_args(args, arg_names)
|
||||||
|
|
||||||
|
if "custom_fields" in host:
|
||||||
|
host["custom_fields"] = json.loads(host["custom_fields"])
|
||||||
|
|
||||||
sc.config.hosts.update(args.host_name, **host)
|
sc.config.hosts.update(args.host_name, **host)
|
||||||
|
|
||||||
|
|
||||||
@ -93,6 +99,10 @@ def do_config_host_create(sc, args):
|
|||||||
'notification_period',
|
'notification_period',
|
||||||
'use']
|
'use']
|
||||||
host = _dict_from_args(args, arg_names)
|
host = _dict_from_args(args, arg_names)
|
||||||
|
|
||||||
|
if "custom_fields" in host:
|
||||||
|
host["custom_fields"] = json.loads(host["custom_fields"])
|
||||||
|
|
||||||
sc.config.hosts.create(**host)
|
sc.config.hosts.create(**host)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user