Beispiel #1
0
def build(name="precise-swift",
          branch="master",
          provisioner="razor",
          template_path=None,
          config=None,
          destroy=False,
          dry=False,
          log=None,
          log_level="INFO"):
    """ Builds an OpenStack Swift storage cluster
    """

    _set_log(log, log_level)

    # provisiong deployment
    util.config = Config(config)
    class_name = util.config["provisioners"][provisioner]
    cprovisioner = util.module_classes(provisioners)[class_name]()
    deployment = ChefDeployment.fromfile(name, branch, cprovisioner,
                                         template_path)
    if dry:
        # build environment
        try:
            deployment.update_environment()
        except Exception:
            util.logger.error(traceback.print_exc())
            deployment.destroy()
            sys.exit(1)

    else:
        util.logger.info(deployment)
        # build deployment
        try:
            deployment.build()
        except Exception:
            util.logger.error(traceback.print_exc())
            deployment.destroy()
            sys.exit(1)

    util.logger.info(deployment)
    if destroy:
        deployment.destroy()
Beispiel #2
0
def build(name="precise-swift", branch="master", provisioner="razor",
          template_path=None, config=None, destroy=False,
          dry=False, log=None, log_level="INFO"):

    """ Builds an OpenStack Swift storage cluster
    """

    _set_log(log, log_level)

    # provisiong deployment
    util.config = Config(config)
    class_name = util.config["provisioners"][provisioner]
    cprovisioner = util.module_classes(provisioners)[class_name]()
    deployment = ChefDeployment.fromfile(name, branch, cprovisioner,
                                         template_path)
    if dry:
        # build environment
        try:
            deployment.update_environment()
        except Exception:
            util.logger.error(traceback.print_exc())
            deployment.destroy()
            sys.exit(1)

    else:
        util.logger.info(deployment)
        # build deployment
        try:
            deployment.build()
        except Exception:
            util.logger.error(traceback.print_exc())
            deployment.destroy()
            sys.exit(1)

    util.logger.info(deployment)
    if destroy:
        deployment.destroy()
Beispiel #3
0
def _load(name="precise-swift", config=None, provisioner="razor"):
    # load deployment and source openrc
    util.config = Config(config)
    class_name = util.config["provisioners"][provisioner]
    cprovisioner = util.module_classes(provisioners)[class_name]()
    return ChefDeployment.from_chef_environment(name, provisioner=cprovisioner)
Beispiel #4
0
def _load(name="precise-swift", config=None, provisioner="razor"):
    # load deployment and source openrc
    util.config = Config(config)
    class_name = util.config["provisioners"][provisioner]
    cprovisioner = util.module_classes(provisioners)[class_name]()
    return ChefDeployment.from_chef_environment(name, provisioner=cprovisioner)