Skip to content

Commit

Permalink
Adds --sql-connection option
Browse files Browse the repository at this point in the history
  • Loading branch information
rconradharris committed Feb 1, 2011
1 parent 087ebf5 commit fe36389
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 5 deletions.
2 changes: 2 additions & 0 deletions bin/glance-combined
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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):
Expand Down
6 changes: 2 additions & 4 deletions bin/glance-registry
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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_option(parser)


def main(_args):
Expand Down
13 changes: 13 additions & 0 deletions glance/registry/db/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
10 changes: 9 additions & 1 deletion run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit fe36389

Please sign in to comment.