Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a way to access the broker's config object outside of the broker #4161

Closed
garlick opened this issue Feb 24, 2022 · 2 comments
Closed

add a way to access the broker's config object outside of the broker #4161

garlick opened this issue Feb 24, 2022 · 2 comments
Assignees

Comments

@garlick
Copy link
Member

garlick commented Feb 24, 2022

Problem: the config object built from parsing TOML config files is accessible only from the broker and its loadable modules. It may be useful to have a front end utility that can interrogate the config and be used to implement conditional logic in rc scripts (among other things).

Implement a config.get RPC in brokercfg.c that fetches the entire config object.

The flux config utility could add a get sub-command that either lets you dump the json object, or takes a key in dotted path format to let you dump a subset or bare value.

@grondo
Copy link
Contributor

grondo commented Feb 25, 2022

This is a great idea. I was thinking that we might have to add conditional logic to rc1 based on configuration (e.g. is exec.use-systemd = true). Is that kind of the idea here?

@garlick
Copy link
Member Author

garlick commented Feb 25, 2022

That's a good example. I was actually thinking about configuring optional modules, like the content back end, or doing some configuration dependent garbage collection in rc1 as mentioned in #258

@garlick garlick self-assigned this Feb 25, 2022
garlick added a commit to garlick/flux-core that referenced this issue Feb 25, 2022
Problem: flux_get_conf() only works in the broker or its loadable
modules; there is no way to access the broker's config from other
locations, for example from rc files.

Add flux-config get subcommand.
Run without arguments, the entire config object is dumped
Run wtih a 'path' argument, a subset of the object, or an individual key
may be dumped.

Output is in compact JSON form.

Fixes flux-framework#4161
garlick added a commit to garlick/flux-core that referenced this issue Feb 25, 2022
Problem: There is no way to query the broker's configuration object
from a shell script such as rc1.

Add the "flux-config get" subcommand.  If run without arguments, it
dumps the entire config object.  Otherwise, it walks a period-separated
path and dumps the result.

By default, the value is printed as compact, string-encoded JSON, unless
it is a bare string value, in which case the string is printed without
quotes.

If the --type=TYPE option is specified, it is an error if the value does
not match the type, which may be any jansson type (object, array, integer,
string, real, boolean) or one of the following special type names:

  any - value matches any type (the default)
  fsd - value must parse as a FSD, printed as its original string form
  fsd-integer - value must parse as a FSD, printed as integer seconds
  fsd-real - value must parse as a FSD, printed a real seconds

If the requested value is not set, or if the type does not match --type,
the program exits with a nonzero exit code.

Fixes flux-framework#4161
garlick added a commit to garlick/flux-core that referenced this issue Feb 26, 2022
Problem: There is no way to query the broker's configuration object
from a shell script such as rc1.

Add the "flux-config get" subcommand.  If run without arguments, it
dumps the entire config object.  Otherwise, it walks a period-separated
path and dumps the result.

By default, the value is printed as compact, string-encoded JSON, unless
it is a bare string value, in which case the string is printed without
quotes.

If the --type=TYPE option is specified, it is an error if the value does
not match the type, which may be any jansson type (object, array, integer,
string, real, boolean) or one of the following special type names:

  any - value matches any type (the default)
  fsd - value must parse as a FSD, printed as its original string form
  fsd-integer - value must parse as a FSD, printed as integer seconds
  fsd-real - value must parse as a FSD, printed a real seconds

If the requested value is not set, then:
- if no --quiet and no --default, an error is printed and program fails
- if --quiet, nothing is printed and program fails
- if --default, the option argument is printed and program succeeds

Fixes flux-framework#4161
garlick added a commit to garlick/flux-core that referenced this issue Feb 26, 2022
Problem: There is no way to query the broker's configuration object
from a shell script such as rc1.

Add the "flux-config get" subcommand.  If run without arguments, it
dumps the entire config object.  Otherwise, it walks a period-separated
path and dumps the result.

By default, the value is printed as compact, string-encoded JSON, unless
it is a bare string value, in which case the string is printed without
quotes.

If the --type=TYPE option is specified, it is an error if the value does
not match the type, which may be any jansson type (object, array, integer,
string, real, boolean) or one of the following special type names:

  any - value matches any type (the default)
  fsd - value must parse as a FSD, printed as its original string form
  fsd-integer - value must parse as a FSD, printed as integer seconds
  fsd-real - value must parse as a FSD, printed a real seconds

If the requested value is not set, then:
- if no --quiet and no --default, an error is printed and program fails
- if --quiet, nothing is printed and program fails
- if --default, the option argument is printed and program succeeds

Fixes flux-framework#4161
garlick added a commit to garlick/flux-core that referenced this issue Feb 28, 2022
Problem: There is no way to query the broker's configuration object
from a shell script such as rc1.

Add the "flux-config get" subcommand.  If run without arguments, it
dumps the entire config object.  Otherwise, it walks a period-separated
path and dumps the result.

By default, the value is printed as compact, string-encoded JSON, unless
it is a bare string value, in which case the string is printed without
quotes.

If the --type=TYPE option is specified, it is an error if the value does
not match the type, which may be any jansson type (object, array, integer,
string, real, boolean) or one of the following special type names:

  any - value matches any type (the default)
  fsd - value must parse as a FSD, printed as its original string form
  fsd-integer - value must parse as a FSD, printed as integer seconds
  fsd-real - value must parse as a FSD, printed a real seconds

If the requested value is not set, then:
- if no --quiet and no --default, an error is printed and program fails
- if --quiet, nothing is printed and program fails
- if --default, the option argument is printed and program succeeds

Fixes flux-framework#4161
@mergify mergify bot closed this as completed in 319f012 Feb 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants