diff --git a/bin/glance-combined b/bin/glance-combined index 77a5c9ce86..3fb8f711af 100755 --- a/bin/glance-combined +++ b/bin/glance-combined @@ -35,6 +35,7 @@ sys.path.append(ROOT_DIR) from glance import version from glance.common import config from glance.common import server +import glance.registry.db import glance.store @@ -98,6 +99,7 @@ def create_options(parser): "virtual machine images to. Choices: ('%s') " "Default: %%default" % "','".join(DEFAULT_STORE_CHOICES)) glance.store.add_options(parser) + glance.registry.db.add_options(parser) def main(_args): diff --git a/bin/glance-registry b/bin/glance-registry index 7bbd41c8d8..032386b59d 100755 --- a/bin/glance-registry +++ b/bin/glance-registry @@ -30,6 +30,7 @@ ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.append(ROOT_DIR) +import glance.registry.db from glance import version from glance.common import config from glance.common import server @@ -75,10 +76,7 @@ def create_options(parser): help="uid under which to run. Default: %default") parser.add_option("--gid", type=int, default=os.getgid(), help="gid under which to run. Default: %default") - parser.add_option('--sql-connection', metavar="CONNECTION", - default='sqlite:///glance.sqlite', - help="A valid SQLAlchemy connection string for the " - "registry database. Default: %default") + glance.registry.db.add_options(parser) def main(_args): diff --git a/glance/registry/db/__init__.py b/glance/registry/db/__init__.py index 497a355bd6..2b48574a34 100644 --- a/glance/registry/db/__init__.py +++ b/glance/registry/db/__init__.py @@ -16,3 +16,16 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. + + +def add_options(parser): + """ + Adds any configuration options that the db layer might have. + + :param parser: An optparse.OptionParser object + :retval None + """ + parser.add_option('--sql-connection', metavar="CONNECTION", + default='sqlite:///glance.sqlite', + help="A valid SQLAlchemy connection string for the " + "registry database. Default: %default") diff --git a/run_tests.sh b/run_tests.sh index bc0cda38ce..52a1dbc972 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -71,4 +71,12 @@ then fi fi -run_tests && pep8 --repeat --show-pep8 --show-source bin/* glance setup.py run_tests.py || exit 1 +# FIXME(sirp): bzr version-info is not currently pep-8. This was fixed with +# lp701898 [1], however, until that version of bzr becomes standard, I'm just +# excluding the vcsversion.py file +# +# [1] https://bugs.launchpad.net/bzr/+bug/701898 +# +PEP8_EXCLUDE=vcsversion.py +PEP8_OPTIONS="--exclude=$PEP8_EXCLUDE --repeat --show-pep8 --show-source" +run_tests && pep8 $PEP8_OPTIONS bin/* glance setup.py run_tests.py || exit 1