Ejemplo n.º 1
0
    def _parse_svc_config(self, json_dic, view=None):
        """
    Parse a json-decoded ApiServiceConfig dictionary into a 2-tuple.

    @param json_dic: The json dictionary with the config data.
    @param view: View to materialize.
    @return: 2-tuple (service config dictionary, role type configurations)
    """
        svc_config = json_to_config(json_dic, view == 'full')
        rt_configs = {}
        if json_dic.has_key(ROLETYPES_CFG_KEY):
            for rt_config in json_dic[ROLETYPES_CFG_KEY]:
                rt_configs[rt_config['roleType']] = \
                    json_to_config(rt_config, view == 'full')

        return (svc_config, rt_configs)
Ejemplo n.º 2
0
  def _parse_svc_config(self, json_dic, view = None):
    """
    Parse a json-decoded ApiServiceConfig dictionary into a 2-tuple.

    @param json_dic: The json dictionary with the config data.
    @param view: View to materialize.
    @return: 2-tuple (service config dictionary, role type configurations)
    """
    svc_config = json_to_config(json_dic, view == 'full')
    rt_configs = { }
    if json_dic.has_key(ROLETYPES_CFG_KEY):
      for rt_config in json_dic[ROLETYPES_CFG_KEY]:
        rt_configs[rt_config['roleType']] = \
            json_to_config(rt_config, view == 'full')

    return (svc_config, rt_configs)
Ejemplo n.º 3
0
    def update_config(self, config):
        """
    Update the host's configuration.

    @param config Dictionary with configuration to update.
    @return Dictionary with updated configuration.
    """
        path = self._path() + '/config'
        resp = self._get_resource_root().put(path, data=config_to_json(config))
        return json_to_config(resp)
Ejemplo n.º 4
0
  def update_config(self, config):
    """
    Update the host's configuration.

    @param config Dictionary with configuration to update.
    @return Dictionary with updated configuration.
    """
    path = self._path() + '/config'
    resp = self._get_resource_root().put(path, data = config_to_json(config))
    return json_to_config(resp)
Ejemplo n.º 5
0
  def update_config(self, config):
    """
    Update the CM configuration.

    @param: config Dictionary with configuration to update.
    @return: Dictionary with updated configuration.
    """
    resp = self._get_resource_root().put('/cm/config',
        data = config_to_json(config))
    return json_to_config(resp, False)
Ejemplo n.º 6
0
    def update_config(self, config):
        """
    Update the CM configuration.

    @param: config Dictionary with configuration to update.
    @return: Dictionary with updated configuration.
    """
        resp = self._get_resource_root().put('/cm/config',
                                             data=config_to_json(config))
        return json_to_config(resp, False)
Ejemplo n.º 7
0
  def get_config(self, view = None):
    """
    Retrieve the Cloudera Manager configuration.

    The 'summary' view contains strings as the dictionary values. The full
    view contains ApiConfig instances as the values.

    @param view: View to materialize ('full' or 'summary')
    @return: Dictionary with configuration data.
    """
    resp = self._get_resource_root().get('/cm/config',
        params = view and dict(view=view) or None)
    return json_to_config(resp, view == 'full')
Ejemplo n.º 8
0
    def get_config(self, view=None):
        """
    Retrieve the role's configuration.

    The 'summary' view contains strings as the dictionary values. The full
    view contains ApiConfig instances as the values.

    @param view: View to materialize ('full' or 'summary')
    @return Dictionary with configuration data.
    """
        path = self._path() + "/config"
        resp = self._get_resource_root().get(path, params=view and dict(view=view) or None)
        return json_to_config(resp, view == "full")
Ejemplo n.º 9
0
  def get_config(self, view = None):
    """
    Retrieve the role's configuration.

    The 'summary' view contains strings as the dictionary values. The full
    view contains ApiConfig instances as the values.

    @param view: View to materialize ('full' or 'summary')
    @return Dictionary with configuration data.
    """
    path = self._path() + '/config'
    resp = self._get_resource_root().get(path,
        params = view and dict(view=view) or None)
    return json_to_config(resp, view == 'full')