示例#1
0
def welcome(ident):
    lower = "| %s %s |" % (ident, version.version_string())
    welcome_header = _get_welcome_stack()
    max_line_len = len(max(welcome_header.splitlines(), key=len))
    footer = color_text(settings.PROG_NICE_NAME, 'green')
    footer += ": "
    footer += color_text(lower, 'blue', True)
    uncolored_footer = (settings.PROG_NICE_NAME + ": " + lower)
    if max_line_len - len(uncolored_footer) > 0:
        #this format string will center the uncolored text which
        #we will then replace with the color text equivalent
        centered_str = center_text(uncolored_footer, " ", max_line_len)
        footer = centered_str.replace(uncolored_footer, footer)
    print(welcome_header)
    print(footer)
    real_max = max(max_line_len, len(uncolored_footer))
    slang = center_text(_welcome_slang(), ' ', real_max)
    print(color_text(slang, 'magenta', bold=True))
    return ("-", real_max)
示例#2
0
def welcome(ident):
    ver_str = version.version_string()
    lower = "|"
    if ident:
        lower += ident
        lower += " "
    lower += ver_str
    lower += "|"
    welcome_header = _get_welcome_stack().strip("\n\r")
    max_line_len = len(max(welcome_header.splitlines(), key=len))
    footer = colored(settings.PROG_NICE_NAME, 'green', attrs=['bold']) + \
                ": " + colored(lower, 'blue', attrs=['bold'])
    uncolored_footer = (settings.PROG_NICE_NAME + ": " + lower)
    if max_line_len - len(uncolored_footer) > 0:
        #this format string wil center the uncolored text which
        #we will then replace
        #with the color text equivalent
        centered_str = center_text(uncolored_footer, " ", max_line_len)
        footer = centered_str.replace(uncolored_footer, footer)
    print((welcome_header + os.linesep + footer))
    return ("-", max_line_len)
示例#3
0
def parse():

    version_str = "%prog v" + version.version_string()
    help_formatter = IndentedHelpFormatter(width=HELP_WIDTH)
    parser = OptionParser(version=version_str, formatter=help_formatter)

    # Root options
    parser.add_option("-v",
                      "--verbose",
                      action="append_const",
                      const=1,
                      dest="verbosity",
                      default=[1],
                      help="increase the verbose level")
    parser.add_option(
        "--dryrun",
        action="store_true",
        dest="dryrun",
        default=False,
        help=("perform ACTION but do not actually run any of the commands"
              " that would normally complete ACTION: (default: %default)"))

    # Install/start/stop/uninstall specific options
    base_group = OptionGroup(
        parser, "Install & uninstall & start & stop specific options")
    base_group.add_option(
        "-p",
        "--persona",
        action="store",
        type="string",
        dest="persona_fn",
        default='conf/personas/devstack.sh.yaml',
        metavar="FILE",
        help="required persona yaml file to apply (default: %default)")
    base_group.add_option("-a",
                          "--action",
                          action="store",
                          type="string",
                          dest="action",
                          metavar="ACTION",
                          help="required action to perform: %s" %
                          (_format_list(actions.get_action_names())))
    base_group.add_option(
        "-d",
        "--directory",
        action="store",
        type="string",
        dest="dir",
        metavar="DIR",
        help=("empty root DIR for install or "
              "DIR with existing components for start/stop/uninstall"))
    base_group.add_option(
        "--no-prompt-passwords",
        action="store_false",
        dest="prompt_for_passwords",
        default=True,
        help="do not prompt the user for passwords",
    )
    parser.add_option_group(base_group)

    # Uninstall and stop options
    stop_un_group = OptionGroup(parser, "Uninstall & stop specific options")
    stop_un_group.add_option(
        "-n",
        "--no-force",
        action="store_true",
        dest="force",
        help=
        "stop the continuation of ACTION if basic errors occur (default: %default)",
        default=False)
    parser.add_option_group(stop_un_group)

    un_group = OptionGroup(parser, "Uninstall specific options")
    un_group.add_option(
        "-k",
        "--keep-old",
        action="store_true",
        dest="keep_old",
        help=
        "uninstall will keep as much of the old install as it can (default: %default)",
        default=False)
    parser.add_option_group(un_group)

    # Extract only what we care about
    (options, args) = parser.parse_args()
    output = dict()
    output['dir'] = options.dir or ""
    output['dryrun'] = options.dryrun or False
    output['action'] = options.action or ""
    output['force'] = not options.force
    output['keep_old'] = options.keep_old
    output['extras'] = args
    output['persona_fn'] = options.persona_fn
    output['verbosity'] = len(options.verbosity)
    output['prompt_for_passwords'] = options.prompt_for_passwords

    return output
示例#4
0
# The encoding of source files.
# source_encoding = 'utf-8-sig'

# The master toctree document.
master_doc = "index"

# General information about the project.
project = u"DEVSTACKpy"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
from devstack import version as devstack_version

release = devstack_version.version_string()
version = devstack_version.canonical_version_string()

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
# language = None

# Set the default Pygments syntax
highlight_language = "python"

# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
# today = ''
# Else, today_fmt is used as the format for a strftime call.
# today_fmt = '%B %d, %Y'
示例#5
0
def parse():

    version_str = "%prog v" + version.version_string()
    help_formatter = IndentedHelpFormatter(width=HELP_WIDTH)
    parser = OptionParser(version=version_str, formatter=help_formatter)
    parser.add_option("-c", "--component",
        action="append",
        dest="component",
        help="openstack component: %s" % (_format_list(settings.COMPONENT_NAMES)))

    base_group = OptionGroup(parser, "Install/uninstall/start/stop options")
    base_group.add_option("-a", "--action",
        action="store",
        type="string",
        dest="action",
        metavar="ACTION",
        help="required action to perform: %s" % (_format_list(settings.ACTIONS)))
    base_group.add_option("-d", "--directory",
        action="store",
        type="string",
        dest="dir",
        metavar="DIR",
        help=("empty root DIR for install or "
              "DIR with existing components for start/stop/uninstall"))
    base_group.add_option("-i", "--ignore-deps",
        action="store_false",
        dest="ensure_deps",
        help="ignore dependencies when performing ACTION")
    base_group.add_option("-e", "--ensure-deps",
        action="store_true",
        dest="ensure_deps",
        help="ensure dependencies when performing ACTION (default: %default)",
        default=True)
    base_group.add_option("-r", "--ref-component",
        action="append",
        dest="r_component",
        metavar="COMPONENT",
        help="component which will not have ACTION applied but will be referenced as if it was (ACTION dependent)")
    base_group.add_option("-k", "--keep-packages",
        action="store_true",
        dest="keep_packages",
        help="uninstall will keep any installed packages on the system")
    parser.add_option_group(base_group)

    stop_un_group = OptionGroup(parser, "Uninstall/stop options")
    stop_un_group.add_option("-f", "--force",
        action="store_true",
        dest="force",
        help="force ACTION even if no trace file found (default: %default)",
        default=True)
    parser.add_option_group(stop_un_group)

    #extract only what we care about
    (options, args) = parser.parse_args()
    output = dict()
    output['components'] = options.component
    output['dir'] = options.dir
    output['ref_components'] = options.r_component
    output['action'] = options.action
    output['force'] = options.force
    output['ignore_deps'] = not options.ensure_deps
    output['keep_packages'] = options.keep_packages
    output['extras'] = args
    return output
示例#6
0
def parse():

    version_str = "%prog v" + version.version_string()
    help_formatter = IndentedHelpFormatter(width=HELP_WIDTH)
    parser = OptionParser(version=version_str, formatter=help_formatter)
    parser.add_option("-c", "--component",
        action="append",
        dest="component",
        help="openstack component: %s" % (_format_list(settings.COMPONENT_NAMES)))

    base_group = OptionGroup(parser, "Install & uninstall & start & stop specific options")
    base_group.add_option("-a", "--action",
        action="store",
        type="string",
        dest="action",
        metavar="ACTION",
        help="required action to perform: %s" % (_format_list(settings.ACTIONS)))
    default_dir = sh.joinpths(tempfile.gettempdir(), DEF_OS_DIR)
    base_group.add_option("-d", "--directory",
        action="store",
        type="string",
        dest="dir",
        metavar="DIR",
        default=default_dir,
        help=("empty root DIR for install or "
              "DIR with existing components for start/stop/uninstall "
              "(default: %default)"))
    base_group.add_option("-i", "--ignore-deps",
        action="store_false",
        dest="ensure_deps",
        help="ignore dependencies when performing ACTION")
    base_group.add_option("-e", "--ensure-deps",
        action="store_true",
        dest="ensure_deps",
        help="ensure dependencies when performing ACTION (default: %default)",
        default=True)
    base_group.add_option("-r", "--ref-component",
        action="append",
        dest="ref_components",
        metavar="COMPONENT",
        help="component which will not have ACTION applied but will be referenced as if it was (ACTION dependent)")
    parser.add_option_group(base_group)

    stop_un_group = OptionGroup(parser, "Uninstall & stop specific options")
    stop_un_group.add_option("-n", "--no-force",
        action="store_true",
        dest="force",
        help="stop the continuation of ACTION if basic errors occur (default: %default)",
        default=False)
    parser.add_option_group(stop_un_group)

    un_group = OptionGroup(parser, "Uninstall specific options")
    un_group.add_option("-k", "--keep-old",
        action="store_true",
        dest="keep_old",
        help="uninstall will keep as much of the old install as it can (default: %default)",
        default=False)
    parser.add_option_group(un_group)

    #extract only what we care about
    (options, args) = parser.parse_args()
    output = dict()
    output['components'] = options.component or list()
    output['dir'] = options.dir or ""
    output['ref_components'] = options.ref_components or list()
    output['action'] = options.action or ""
    output['force'] = not options.force
    output['ignore_deps'] = not options.ensure_deps
    output['keep_old'] = options.keep_old
    output['extras'] = args

    LOG.debug("Extracted options %s" % (output))

    return output
示例#7
0
def parse():

    #version
    version_str = "%prog v" + version.version_string()
    help_formatter = IndentedHelpFormatter(width=HELP_WIDTH)
    parser = OptionParser(version=version_str, formatter=help_formatter)

    known_components = sorted(settings.COMPONENT_NAMES)
    components = "(" + ", ".join(known_components) + ")"
    parser.add_option("-c", "--component",
        action="append",
        dest="component",
        help="openstack component, ie %s" % (components))

    base_group = OptionGroup(parser, "Install/uninstall/start/stop options")
    known_actions = sorted(settings.ACTIONS)
    actions = "(" + ", ".join(known_actions) + ")"
    base_group.add_option("-a", "--action",
            action="store",
            type="string",
            dest="action",
            metavar="ACTION",
            help="action to perform, ie %s" % (actions))
    base_group.add_option("-d", "--directory",
        action="store",
        type="string",
        dest="dir",
        metavar="DIR",
        help="empty root DIR for install or "\
             "DIR with existing components for start/stop/uninstall")
    base_group.add_option("-i", "--ignore-deps",
        action="store_false",
        dest="ensure_deps",
        help="ignore dependencies when performing ACTION")
    base_group.add_option("-e", "--ensure-deps",
        action="store_true",
        dest="ensure_deps",
        help="ensure dependencies when performing ACTION (default: %default)",
        default=True)
    base_group.add_option("-r", "--ref-component",
        action="append",
        dest="r_component",
        metavar="COMPONENT",
        help="component which will not have ACTION applied but will be referenced as if it was (ACTION dependent)")
    parser.add_option_group(base_group)

    stop_un_group = OptionGroup(parser, "Uninstall/stop options")
    stop_un_group.add_option("-f", "--force",
        action="store_true",
        dest="force",
        help="force ACTION even if no trace file found (default: %default)",
        default=True)
    parser.add_option_group(stop_un_group)

    misc_group = OptionGroup(parser, "Miscellaneous options")
    misc_group.add_option("--list-deps",
        action="store_true",
        dest="list_deps",
        help="show dependencies of COMPONENT (default: %default)",
        default=False)
    misc_group.add_option("--describe-components",
        action="store_true",
        dest="describe_comp",
        help="describe COMPONENT (default: %default)",
        default=False)
    parser.add_option_group(misc_group)

    (options, args) = parser.parse_args()

    #extract only what we care about
    output = dict()
    output['components'] = options.component
    output['dir'] = options.dir
    output['ref_components'] = options.r_component
    output['action'] = options.action
    output['list_deps'] = options.list_deps
    output['describe_comp'] = options.describe_comp
    output['force'] = options.force
    if options.ensure_deps:
        output['ignore_deps'] = False
    else:
        output['ignore_deps'] = True
    output['extras'] = args
    return output
示例#8
0
source_suffix = '.rst'

# The encoding of source files.
#source_encoding = 'utf-8-sig'

# The master toctree document.
master_doc = 'index'

# General information about the project.
project = u'DEVSTACKpy'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
from devstack import version as devstack_version
release = devstack_version.version_string()
version = devstack_version.canonical_version_string()

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None

# Set the default Pygments syntax
highlight_language = 'python'

# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
示例#9
0
def parse():

    version_str = "%prog v" + version.version_string()
    help_formatter = IndentedHelpFormatter(width=HELP_WIDTH)
    parser = OptionParser(version=version_str, formatter=help_formatter)

    # Root options
    parser.add_option("-v", "--verbose",
        action="append_const",
        const=1,
        dest="verbosity",
        default=[1],
        help="increase the verbose level")
    parser.add_option("--dryrun",
        action="store_true",
        dest="dryrun",
        default=False,
        help=("perform ACTION but do not actually run any of the commands"
              " that would normally complete ACTION: (default: %default)"))

    # Install/start/stop/uninstall specific options
    base_group = OptionGroup(parser, "Install & uninstall & start & stop specific options")
    base_group.add_option("-p", "--persona",
        action="store",
        type="string",
        dest="persona_fn",
        default='conf/personas/devstack.sh.yaml',
        metavar="FILE",
        help="required persona yaml file to apply (default: %default)")
    base_group.add_option("-a", "--action",
        action="store",
        type="string",
        dest="action",
        metavar="ACTION",
        help="required action to perform: %s" % (_format_list(actions.get_action_names())))
    base_group.add_option("-d", "--directory",
        action="store",
        type="string",
        dest="dir",
        metavar="DIR",
        help=("empty root DIR for install or "
              "DIR with existing components for start/stop/uninstall"))
    base_group.add_option("--no-prompt-passwords",
                          action="store_false",
                          dest="prompt_for_passwords",
                          default=True,
                          help="do not prompt the user for passwords",
                          )
    parser.add_option_group(base_group)

    # Uninstall and stop options
    stop_un_group = OptionGroup(parser, "Uninstall & stop specific options")
    stop_un_group.add_option("-n", "--no-force",
        action="store_true",
        dest="force",
        help="stop the continuation of ACTION if basic errors occur (default: %default)",
        default=False)
    parser.add_option_group(stop_un_group)

    un_group = OptionGroup(parser, "Uninstall specific options")
    un_group.add_option("-k", "--keep-old",
        action="store_true",
        dest="keep_old",
        help="uninstall will keep as much of the old install as it can (default: %default)",
        default=False)
    parser.add_option_group(un_group)

    # Extract only what we care about
    (options, args) = parser.parse_args()
    output = dict()
    output['dir'] = options.dir or ""
    output['dryrun'] = options.dryrun or False
    output['action'] = options.action or ""
    output['force'] = not options.force
    output['keep_old'] = options.keep_old
    output['extras'] = args
    output['persona_fn'] = options.persona_fn
    output['verbosity'] = len(options.verbosity)
    output['prompt_for_passwords'] = options.prompt_for_passwords

    return output