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

Config parsing requires underscores and config section headers #16

Open
bsanders opened this issue Jun 29, 2016 · 9 comments
Open

Config parsing requires underscores and config section headers #16

bsanders opened this issue Jun 29, 2016 · 9 comments

Comments

@bsanders
Copy link

Technically, Ceph doesn't require a '[global]' header, but the library (well, Python's ConfigParser) fails if the ceph.conf doesn't have it.

The ceph-cfg also requires underscores in the key names, whereas Ceph allows spaces as word separators (and hyphens, for that matter). So "mon initial members" fails, expecting "mon_initial_members".

@oms4suse
Copy link
Owner

Thankyou. I really need to address this as Tim Serong has also reported to me this issue.

@bsanders
Copy link
Author

Much appreciated! Thankfully, both issues are pretty easy to work around.

@oms4suse
Copy link
Owner

oms4suse commented Jul 7, 2016

I haven’t yet found a way around the [global] section being optional.

I am just testing a patch that allows white space in the key names

#20

@oms4suse
Copy link
Owner

The patch has now been merged.

@bsanders
Copy link
Author

As far as the global section goes, the only thing I've seen is to catch the exception being thrown and re-try with a pre-pended string. Discussed in the first and second answers to this SO question.

It's a little bit of a hack, but not too bad.

@bsanders
Copy link
Author

Interestingly, Python issue 22253 discusses the idea of creating an "empty-string" section for "Sectionless" config files instead of raising the exception. There's a patch, but it looks like not much traction with it.

@bsanders
Copy link
Author

I just opened a PR #35 to address the issue of allowing a ceph.conf that doesn't have an explicit '[global]' header. I don't love the result (requires an intermediate object), but I honestly couldn't find a cleaner way, either.

@oms4suse
Copy link
Owner

@bsanders I looked at your PR and did not feel happy with it. Tox tests where failing and it failed when I tried to deploy with it. I made this PR and it passed my testing.

#37

Would you be so kind as t review it ?

@bsanders
Copy link
Author

Oh my, yes. Much, much better. Mine worked locally, but I didn't like it. Thank you for taking the time to fix the issue. I'll close my PR.

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