Skip to content

Add some features to fedmsg-config #222

Merged
merged 2 commits into from Feb 17, 2014

2 participants

@olasd
olasd commented Feb 16, 2014

I'm not sure about the disable_defaults flag to fedmsg.config.load_config, but that's the cleanest way I could think of to be able to query stuff from a single file, which is something I will need for proper integration of fedmsg with Debian's package configuration system.

@olasd olasd Add a `disable_defaults` option to the config parser
This option is useful to force the parsing of a single configuration file,
for instance to be able to query a configuration value set in that file.
2e56466
@ralphbean ralphbean commented on an outdated diff Feb 16, 2014
fedmsg/commands/config.py
+ keys = args.query.split('.')
+ curpath = []
+ for key in keys:
+ curpath.append(key)
+ if key in cur:
+ cur = cur[key]
+ else:
+ print >>sys.stderr, (
+ "Key `%s` does not exist in config" % ".".join(curpath)
+ )
+ sys.exit(1)
+
+ if isinstance(cur, list):
+ for i in cur:
+ print i
+ elif isinstance(cur, str):
@ralphbean
Fedora Infrastructure member
ralphbean added a note Feb 16, 2014

Perhaps make this basestring instead of str (to catch unicode values if they show up)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@ralphbean
Fedora Infrastructure member

@olasd, this is great. Thanks! If you could make the one above change w.r.t. str/basestring, I'll merge.

@olasd olasd Add some features to fedmsg-config
 --query: retrieve the value of a given configuration key
 --disable-defaults: only print overridden configuration values
 --config-filename: only print the configuration for the given file
7637986
@olasd
olasd commented Feb 16, 2014

@threebean Done!

@ralphbean ralphbean merged commit e5a3a18 into fedora-infra:develop Feb 17, 2014

1 check passed

Details default The Travis CI build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.