From: Alfredo Deza Date: Wed, 12 Jul 2017 16:31:39 +0000 (-0400) Subject: ceph-volume: main: if no args are passed mention the --help usage, print some information X-Git-Tag: ses5-milestone10~3^2~5^2~52 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=83e4c0665f53b78d511e13083d75db37e7f002fa;p=ceph.git ceph-volume: main: if no args are passed mention the --help usage, print some information Signed-off-by: Alfredo Deza --- diff --git a/src/ceph-volume/ceph_volume/main.py b/src/ceph-volume/ceph_volume/main.py index a7208306a61b..0a269ebd7ac5 100644 --- a/src/ceph-volume/ceph_volume/main.py +++ b/src/ceph-volume/ceph_volume/main.py @@ -12,22 +12,17 @@ from ceph_volume import log, devices, configuration, conf, exceptions, terminal class Volume(object): _help = """ ceph-volume: Deploy Ceph OSDs using different device technologies like lvm or -physical disks +physical disks. Version: {version} -Global Options: ---log, --logging Set the level of logging. Acceptable values: - debug, warning, error, critical ---log-path Change the default location ('/var/lib/ceph') for logging ---cluster Change the default cluster name ('ceph') - Log Path: {log_path} Ceph Conf: {ceph_path} {sub_help} {plugins} {environ_vars} +{warning} """ def __init__(self, argv=None, parse=True): @@ -38,8 +33,10 @@ Ceph Conf: {ceph_path} if parse: self.main(argv) - def help(self): + def help(self, warning=False): + warning = 'See "ceph-volume --help" for full list of options.' if warning else '' return self._help.format( + warning=warning, version=ceph_volume.__version__, log_path=conf.log_path, ceph_path=self.stat_ceph_conf(), @@ -106,16 +103,15 @@ Ceph Conf: {ceph_path} self.load_log_path() self.enable_plugins() sanitized_args = self._get_sanitized_args() - help_text = self.help() # no flags where passed in, return the help menu instead of waiting for # argparse which will end up complaning that there are no args if len(sys.argv) <= 1: - print help_text + print self.help(warning=True) return parser = argparse.ArgumentParser( prog='ceph-volume', formatter_class=argparse.RawDescriptionHelpFormatter, - description=help_text, + description=self.help(), ) parser.add_argument( '--cluster',