generate_sample.sh doesn't set a sane default unless your base directory is the project name

Bug #1288417 reported by Jay Bryant
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo-incubator
Fix Released
Medium
Ben Nemec

Bug Description

In the case that your config file is out of date it reports the following help text:

check_uptodate.sh: cinder.conf.sample is not up to date.
check_uptodate.sh: Please run ./tools/config/generate_sample.sh.

Running that command, however, fails with the following:

generate_sample.sh: invalid project package name
Try `generate_sample.sh --help' for more information.

The help text should be updated to:

check_uptodate.sh: cinder.conf.sample is not up to date.
check_uptodate.sh: Please run ./tools/config/generate_sample.sh -p cinder.

Jay Bryant (jsbryant)
Changed in oslo:
assignee: nobody → Jay Bryant (jsbryant)
Revision history for this message
Ben Nemec (bnemec) wrote :

I think the problem here is that the generate_sample script in cinder is out of date. generate_sample.sh has sane defaults now so you shouldn't need to specify the project.

https://github.com/openstack/cinder/blob/master/tools/conf/generate_sample.sh
https://github.com/openstack/oslo-incubator/blob/master/tools/config/generate_sample.sh

Although there's still going to be an issue there because cinder put those scripts in conf instead of config. :-/

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to oslo-incubator (master)

Fix proposed to branch: master
Review: https://review.openstack.org/78422

Changed in oslo:
status: New → In Progress
Revision history for this message
Jay Bryant (jsbryant) wrote : Re: help text from check_uptodate.sh is no longer correct

Ben, I found this problem while trying to test the new merge for config into Cinder: https://review.openstack.org/#/c/75740/

I don't see anywhere in generate_sample.sh that it is setting up a default for package at the moment. If that is really the bug here I can abandon the patch I just put up and figure out a way to fix that instead.

Revision history for this message
Ben Nemec (bnemec) wrote :

Actually, I see now that cinder isn't even using the oslo config tools. I think what needs to happen here is that we need to sync the current oslo config tools to cinder and update its tox.ini to use them instead of the outdated ones that are there now.

Revision history for this message
Ben Nemec (bnemec) wrote :

Well, we are setting a default for package name: https://github.com/openstack/oslo-incubator/blob/master/tools/config/generate_sample.sh#L68

Looking through the patch sets on that change, it looks like the most recent generator failure is because tox.ini hadn't been updated to point at the new generate_sample.sh yet. Now that it has everything should Just Work. :-)

I subscribed to the review, so if it fails due to the config generator again I'll take a look at why.

Revision history for this message
Jay Bryant (jsbryant) wrote :

Ben, I looked at this closer and it appears that the problem is that generate_sample.sh assumes that you have cloned your code to a directory with the same name as your project. This breaks if you are clone to directories with different names. Seems like there must be a better solution for this.

summary: - help text from check_uptodate.sh is no longer correct
+ generate_sample.sh doesn't set a sane default unless your base directory
+ is the project name
Revision history for this message
Ben Nemec (bnemec) wrote :

Okay, that makes sense. I'm not sure we can change that, unless you can come up with another way to infer the project name that doesn't rely on update.py. At some point this needs to graduate, so we won't be able to use that anymore.

What we can definitely do, though, is improve the error message to include the incorrect project name. That should make it pretty obvious to anyone who hits that problem what is wrong, and they can just specify the project manually. And next time they shouldn't change the name of the directory the git repo clones to. :-P

Changed in oslo:
importance: Undecided → Medium
Revision history for this message
Doug Hellmann (doug-hellmann) wrote :

Can we use "python setup.py --name" to get the project name?

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to oslo-incubator (master)

Fix proposed to branch: master
Review: https://review.openstack.org/79429

Changed in oslo:
assignee: Jay Bryant (jsbryant) → Ben Nemec (bnemec)
Revision history for this message
Ben Nemec (bnemec) wrote :

That seems to work fine. See the patch I just proposed.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to oslo-incubator (master)

Reviewed: https://review.openstack.org/79429
Committed: https://git.openstack.org/cgit/openstack/oslo-incubator/commit/?id=f6a1848688483c34be2fb5ba2544f80bc659a26c
Submitter: Jenkins
Branch: master

commit f6a1848688483c34be2fb5ba2544f80bc659a26c
Author: Ben Nemec <email address hidden>
Date: Mon Mar 10 19:48:14 2014 +0000

    Be smarter about config generator default package name

    Using python setup.py --name instead of the current working
    directory will allow the config generator to work correctly by
    default even if the local source tree was cloned into a directory
    that doesn't match the project name.

    Change-Id: Iea529e7e691d94402f658e7095387dc3e98e32fe
    Closes-Bug: #1288417

Changed in oslo:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in oslo:
milestone: none → icehouse-rc1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in oslo:
milestone: icehouse-rc1 → 2014.1
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.