def __init__(self, config, version='1.3.2'): self._config_template = config self.services = [] self.configurations = {} self.node_groups = {} self.version = version self.user_input_handlers = {} cluster_template = json.loads(config) self._parse_services(cluster_template) self._parse_configurations(cluster_template) self._process_node_groups(template_json=cluster_template)
def create_operational_config(self, cluster, user_inputs, scaled_groups=None): if scaled_groups is None: scaled_groups = {} self._determine_deployed_services(cluster) self._process_node_groups(cluster=cluster) for ng_id in scaled_groups: existing = next(group for group in self.node_groups.values() if group.id == ng_id) existing.count = scaled_groups[ng_id] self.validate_node_groups(cluster) self._finalize_ng_components() self._parse_configurations(json.loads(self._config_template)) self._process_user_inputs(user_inputs) self._replace_config_tokens()
def _from_json(self, datastring): try: return jsonutils.loads(datastring) except ValueError: msg = _("cannot understand JSON") raise exception.MalformedRequestBody(reason=msg)
def process_result_value(self, value, dialect): if value is not None: value = jsonutils.loads(value) return value