Merge "Specify the default root dir in opts."
This commit is contained in:
commit
852440a65c
@ -29,7 +29,6 @@ sys.path.insert(0, os.path.abspath(os.getcwd()))
|
|||||||
from anvil import actions
|
from anvil import actions
|
||||||
from anvil import colorizer
|
from anvil import colorizer
|
||||||
from anvil import distro
|
from anvil import distro
|
||||||
from anvil import env
|
|
||||||
from anvil import exceptions as excp
|
from anvil import exceptions as excp
|
||||||
from anvil import log as logging
|
from anvil import log as logging
|
||||||
from anvil import opts
|
from anvil import opts
|
||||||
@ -71,15 +70,8 @@ def run(args):
|
|||||||
if not sh.isfile(persona_fn):
|
if not sh.isfile(persona_fn):
|
||||||
raise excp.OptionException("Invalid persona file %r specified!" % (persona_fn))
|
raise excp.OptionException("Invalid persona file %r specified!" % (persona_fn))
|
||||||
|
|
||||||
# Determine + setup the root directory...
|
# Determine the root directory...
|
||||||
# If not provided attempt to locate it via the environment control files
|
root_dir = sh.abspth(args.pop("dir"))
|
||||||
args_root_dir = args.pop("dir")
|
|
||||||
root_dir = env.get_key('INSTALL_ROOT')
|
|
||||||
if not root_dir:
|
|
||||||
root_dir = args_root_dir
|
|
||||||
if not root_dir:
|
|
||||||
root_dir = sh.joinpths(sh.gethomedir(), 'openstack')
|
|
||||||
root_dir = sh.abspth(root_dir)
|
|
||||||
|
|
||||||
(repeat_string, line_max_len) = utils.welcome()
|
(repeat_string, line_max_len) = utils.welcome()
|
||||||
print(pprint.center_text("Action Runner", repeat_string, line_max_len))
|
print(pprint.center_text("Action Runner", repeat_string, line_max_len))
|
||||||
|
@ -25,6 +25,7 @@ from optparse import OptionParser
|
|||||||
from optparse import OptionValueError
|
from optparse import OptionValueError
|
||||||
|
|
||||||
from anvil import actions
|
from anvil import actions
|
||||||
|
from anvil import env
|
||||||
from anvil import settings
|
from anvil import settings
|
||||||
from anvil import shell as sh
|
from anvil import shell as sh
|
||||||
from anvil import utils
|
from anvil import utils
|
||||||
@ -100,6 +101,13 @@ class SmithyHelpFormatter(IndentedHelpFormatter):
|
|||||||
return buf.getvalue()
|
return buf.getvalue()
|
||||||
|
|
||||||
|
|
||||||
|
def _get_default_dir():
|
||||||
|
root_dir = env.get_key('INSTALL_ROOT')
|
||||||
|
if root_dir:
|
||||||
|
return root_dir
|
||||||
|
return sh.joinpths(sh.gethomedir(), 'openstack')
|
||||||
|
|
||||||
|
|
||||||
def parse(previous_settings=None):
|
def parse(previous_settings=None):
|
||||||
|
|
||||||
version_str = "%s v%s" % ('anvil', version.version_string())
|
version_str = "%s v%s" % ('anvil', version.version_string())
|
||||||
@ -167,7 +175,8 @@ def parse(previous_settings=None):
|
|||||||
type="string",
|
type="string",
|
||||||
dest="dir",
|
dest="dir",
|
||||||
metavar="DIR",
|
metavar="DIR",
|
||||||
help=("empty root DIR or DIR with existing components"))
|
default=_get_default_dir(),
|
||||||
|
help=("empty root DIR or DIR with existing components (default: %default)"))
|
||||||
parser.add_option_group(base_group)
|
parser.add_option_group(base_group)
|
||||||
|
|
||||||
suffixes = ("Known suffixes 'K' (kilobyte, 1024),"
|
suffixes = ("Known suffixes 'K' (kilobyte, 1024),"
|
||||||
|
Loading…
Reference in New Issue
Block a user