Skip to content

Commit

Permalink
Merge "Allows new style config to be used for --flagfile"
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins authored and openstack-gerrit committed Mar 6, 2012
2 parents 9bb2a33 + 9627c88 commit 8979743
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions nova/compat/flagfile.py
Expand Up @@ -97,6 +97,10 @@ def _read_flagfile(arg, next_arg, tempdir=None):

args = _read_lines(flagfile)

if args and not args[0].startswith('--'):
# This is a config file, not a flagfile, so return it.
return ['--config-file=' + flagfile] + argp[1:]

#
# We're recursing here to convert any --flagfile arguments
# read from this flagfile into --config-file arguments
Expand Down
9 changes: 7 additions & 2 deletions nova/tests/test_compat_flagfile.py
Expand Up @@ -18,7 +18,6 @@
import os
import shutil
import StringIO
import stubout
import textwrap
import tempfile
import unittest
Expand Down Expand Up @@ -150,9 +149,15 @@ def test_boolean_inverted_flag(self):
self._do_test_flagfile('--noverbose', 'verbose=false\n')

def test_flagfile_comments(self):
self._do_test_flagfile('--bar=foo\n#foo\n--foo=bar\n//bar',
self._do_test_flagfile(' \n\n#foo\n--bar=foo\n--foo=bar\n//bar',
'bar=foo\nfoo=bar\n')

def test_flagfile_is_config(self):
self.files['foo.flags'] = '\n\n#foo\n//bar\n[DEFAULT]\nbar=foo'
before = ['--flagfile=foo.flags']
after = flagfile.handle_flagfiles(before, tempdir=self.tempdir)
self.assertEquals(after, ['--config-file=foo.flags'])

def test_flagfile_nested(self):
self.files['bar.flags'] = '--foo=bar'

Expand Down

0 comments on commit 8979743

Please sign in to comment.