Dmitry Tantsur 4bd594fa0c Import code working with Ironic nodes from os_cloud_config
This patch introduces tripleo_common.utils.{glance,nodes} modules.
The glance one is imported with only import fixes (including importing
a private exceptions module from the glance client).

The nodes.py is a rewritten and fixed version taken from
https://review.openstack.org/#/c/263309/. Main changes:
* Stop hardcoding flavor (e.g. agent, pxe) for each driver
* Support only generic properties with pm_* names. Driver-specific things
  should stay with their prefix. Existing pm_* driver-specific things
  were deprecated.
* Pass through everything that starts with driver-specific prefix to
  node's driver_info.
* Dropped handling Conflict exceptions - ironicclient is doing it for
  some time already (and does better job in it).
* Issue a specific exception for malformed instackenv.json.
* Optimize calls to ironic (use list with details instead of list+get)
* Use 'add' operation instead of 'replace', as it allows both adding
  and overwriting (despite its name).
* Fixed some small issues like adding a dict to a set.

Change-Id: I7efffc5c6627776a20fad4bf4cf266330c4b8b6b
2016-03-21 16:53:49 +00:00

23 lines
808 B
Python

# -*- coding: utf-8 -*-
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
class InvalidNode(ValueError):
"""Node data is invalid."""
def __init__(self, message, node=None):
message = 'Invalid node data: %s' % message
self.node = node
super(InvalidNode, self).__init__(message)