def _show(name): """ :returns: process status :rtype: int """ toml_config = config.get_config(True) if name is not None: file_value = toml_config.get(name) try: # If the user presented a partial key name, eg 'core' when # we have 'core.xyz'; we will get an exception here effective_value, envvar_name = config.get_config_val_envvar(name) except DCOSException as e: # The expected case of a partial key name has special # handling via this mechanism. if isinstance(file_value, collections.Mapping): exc_msg = config.generate_choice_msg(name, file_value) raise DCOSException(exc_msg) raise # Unexpected errors, pass right along if effective_value is None: raise DCOSException("Property {!r} doesn't exist".format(name)) else: msg = _format_config(file_value, effective_value, envvar_name=envvar_name) emitter.publish(msg) else: # Let's list all of the values for key, value in sorted(toml_config.property_items()): file_value = toml_config.get(key) effective_value, envvar_name = config.get_config_val_envvar(key) msg = _format_config(file_value, effective_value, key, envvar_name=envvar_name) emitter.publish(msg) return 0
def _show(name): """ :returns: process status :rtype: int """ toml_config = config.get_config(True) if name is not None: file_value = toml_config.get(name) try: # If the user presented a partial key name, eg 'core' when # we have 'core.xyz'; we will get an exception here effective_value, envvar_name = config.get_config_val_envvar(name) except DCOSException as e: # The expected case of a partial key name has special # handling via this mechanism. if isinstance(file_value, collections.Mapping): exc_msg = config.generate_choice_msg(name, file_value) raise DCOSException(exc_msg) raise # Unexpected errors, pass right along if effective_value is None: raise DCOSException("Property {!r} doesn't exist".format(name)) else: msg = _format_config(file_value, effective_value, envvar_name=envvar_name) emitter.publish(msg) else: # Let's list all of the values for key, value in sorted(toml_config.property_items()): file_value = toml_config.get(key) effective_value, envvar_name = config.get_config_val_envvar(key) msg = _format_config(file_value, effective_value, key, envvar_name=envvar_name) emitter.publish(msg) return 0
def _show(name): """ :returns: process status :rtype: int """ toml_config = util.get_config(True) if name is not None: value = toml_config.get(name) if value is None: raise DCOSException("Property {!r} doesn't exist".format(name)) elif isinstance(value, collections.Mapping): raise DCOSException(config.generate_choice_msg(name, value)) else: emitter.publish(value) else: # Let's list all of the values for key, value in sorted(toml_config.property_items()): emitter.publish('{}={}'.format(key, value)) return 0
def _show(name): """ :returns: process status :rtype: int """ toml_config = util.get_config(True) if name is not None: value = toml_config.get(name) if value is None: raise DCOSException("Property {!r} doesn't exist".format(name)) elif isinstance(value, collections.Mapping): raise DCOSException(config.generate_choice_msg(name, value)) else: emitter.publish(value) else: # Let's list all of the values for key, value in sorted(toml_config.property_items()): emitter.publish('{}={}'.format(key, value)) return 0