Exemple #1
0
 def _check_existing(self, config, options):
     """Make sure that there isn't a stage with this name already.
     If there is, panic.
     """
     try:
         log.debug("checking for existing stage ...")
         StageConfig.make(options.name)
     except EnvironmentError:
         pass
     else:
         sys.exit("there seem to be a stage with that name already")
Exemple #2
0
 def _check_existing(self, config, options):
     """Make sure that there isn't a stage with this name already.
     If there is, panic.
     """
     try:
         log.debug("checking for existing stage ...")
         StageConfig.make(options.name)
     except EnvironmentError:
         pass
     else:
         sys.exit("there seem to be a stage with that name already")
Exemple #3
0
def main():
    """Main entry point for the command-line tool."""
    parser = argparse.ArgumentParser(
        prog='gilliam-aws',
        formatter_class=argparse.RawDescriptionHelpFormatter)
    parser.add_argument('--verbose', action='store_true')
    parser.add_argument('-D', '--debug', action='store_true')
    parser.add_argument('-s', '--stage',
                        metavar='STAGE', dest='stage')
    parser.add_argument('-q', '--quiet', dest='quiet',
                        action='store_true', default=False)
    cmds = dict(_init_commands(parser))

    options = parser.parse_args()
    logging.basicConfig(
        stream=sys.stdout,
        level=(logging.DEBUG if options.debug else
               logging.INFO if options.verbose else
               logging.WARNING),
        format=_DEBUG_FORMAT if options.debug else _NORMAL_FORMAT)

    project_dir = util.find_rootdir()

    form_config = (
        FormationConfig.make(project_dir) if project_dir else
        None)
    options.stage = (
        options.stage if options.stage else
        form_config.stage if form_config else
        None)


    try:
        stage_config = (
            StageConfig.make(options.stage) if options.stage else
            None)
    except EnvironmentError as err:
        sys.exit("%s: %s: cannot read stage config: %s" % (
                options.cmd, options.stage, err))

    config = Config(project_dir, stage_config, options.stage)
                         
    cmd = cmds[options.cmd]
    cmd.handle(config, options)
Exemple #4
0
def main():
    """Main entry point for the command-line tool."""
    parser = argparse.ArgumentParser(
        prog='gilliam-aws',
        formatter_class=argparse.RawDescriptionHelpFormatter)
    parser.add_argument('--verbose', action='store_true')
    parser.add_argument('-D', '--debug', action='store_true')
    parser.add_argument('-s', '--stage', metavar='STAGE', dest='stage')
    parser.add_argument('-q',
                        '--quiet',
                        dest='quiet',
                        action='store_true',
                        default=False)
    cmds = dict(_init_commands(parser))

    options = parser.parse_args()
    logging.basicConfig(
        stream=sys.stdout,
        level=(logging.DEBUG if options.debug else
               logging.INFO if options.verbose else logging.WARNING),
        format=_DEBUG_FORMAT if options.debug else _NORMAL_FORMAT)

    project_dir = util.find_rootdir()

    form_config = (FormationConfig.make(project_dir) if project_dir else None)
    options.stage = (options.stage if options.stage else
                     form_config.stage if form_config else None)

    try:
        stage_config = (StageConfig.make(options.stage)
                        if options.stage else None)
    except EnvironmentError as err:
        sys.exit("%s: %s: cannot read stage config: %s" %
                 (options.cmd, options.stage, err))

    config = Config(project_dir, stage_config, options.stage)

    cmd = cmds[options.cmd]
    cmd.handle(config, options)