# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-import yaml
import json
import platform
-from .common import constants
-from .common import utils
+import yaml
+
+from apex.common import constants
+from apex.common import utils
class Inventory(dict):
super().__init__({'nodes': list(map(munge_nodes, init_dict['nodes']))})
# verify number of nodes
- if ha and len(self['nodes']) < 5:
+ if ha and len(self['nodes']) < 5 and not virtual:
raise InventoryException('You must provide at least 5 '
'nodes for HA baremetal deployment')
elif len(self['nodes']) < 2:
def dump_instackenv_json(self):
print(json.dumps(dict(self), sort_keys=True, indent=4))
- def dump_bash(self, path=None):
- """
- Prints settings for bash consumption.
-
- If optional path is provided, bash string will be written to the file
- instead of stdout.
- """
- bash_str = "{}={}\n".format('root_disk_list', str(self.root_device))
- utils.write_str(bash_str, path)
-
class InventoryException(Exception):
def __init__(self, value):