示例#1
0
def main():
    args = parse_args()
    environment._configure_logging(args)
    try:
        environment._ensure()
        client = clients.get_nova_bm_client()
        flavors.cleanup_flavors(client)
        root_disk = os.environ.get('ROOT_DISK', None)
        if args.nodes:
            with open(args.nodes, 'r') as nodes_file:
                nodes_list = json.load(nodes_file)
            flavors.create_flavors_from_nodes(client, nodes_list, args.kernel,
                                              args.ramdisk, root_disk)
        elif args.flavors:
            with open(args.flavors, 'r') as flavors_file:
                flavors_list = json.load(flavors_file)
            flavors.create_flavors_from_list(client, flavors_list, args.kernel,
                                             args.ramdisk)
        elif args.ironic:
            ironic_client = clients.get_ironic_client()
            flavors.create_flavors_from_ironic(client, ironic_client,
                                               args.kernel, args.ramdisk,
                                               root_disk)
    except Exception:
        logging.exception("Unexpected error during command execution")
        return 1
    return 0
def main():
    args = parse_args()
    environment._configure_logging(args)

    try:
        with open(args.nodes, 'r') as node_file:
            nodes_list = json.load(node_file)
        environment._ensure()

        keystone_client = _clients.get_keystone_client()
        glance_client = _clients.get_glance_client()
        client = _clients.get_ironic_client()

        nodes.register_all_nodes(args.service_host,
                                 nodes_list,
                                 client=client,
                                 remove=args.remove,
                                 blocking=True,
                                 keystone_client=keystone_client,
                                 glance_client=glance_client,
                                 kernel_name=args.kernel_name,
                                 ramdisk_name=args.ramdisk_name)
    except Exception:
        logging.exception("Unexpected error during command execution")
        return 1
    return 0
示例#3
0
def main():
    args = parse_args()
    environment._configure_logging(args)
    try:
        environment._ensure()
        client = clients.get_nova_bm_client()
        flavors.cleanup_flavors(client)
        root_disk = os.environ.get('ROOT_DISK', None)
        if args.nodes:
            with open(args.nodes, 'r') as nodes_file:
                nodes_list = json.load(nodes_file)
            flavors.create_flavors_from_nodes(
                client, nodes_list, args.kernel, args.ramdisk, root_disk)
        elif args.flavors:
            with open(args.flavors, 'r') as flavors_file:
                flavors_list = json.load(flavors_file)
            flavors.create_flavors_from_list(
                client, flavors_list, args.kernel, args.ramdisk)
        elif args.ironic:
            ironic_client = clients.get_ironic_client()
            flavors.create_flavors_from_ironic(
                client, ironic_client, args.kernel, args.ramdisk, root_disk)
    except Exception:
        logging.exception("Unexpected error during command execution")
        return 1
    return 0
def main():
    args = parse_args()
    environment._configure_logging(args)
    try:
        environment._ensure()
        keystone_client = clients.get_keystone_v3_client()
        initialize_for_heat(keystone_client, args.domain_admin_password)
    except Exception:
        logging.exception("Unexpected error during command execution")
        return 1
    return 0
示例#5
0
def main():
    args = parse_args()
    environment._configure_logging(args)
    try:
        environment._ensure()
        keystone_client = clients.get_keystone_v3_client()
        initialize_for_heat(keystone_client, args.domain_admin_password)
    except Exception:
        logging.exception("Unexpected error during command execution")
        return 1
    return 0
示例#6
0
def main():
    args = parse_args()
    environment._configure_logging(args)
    try:
        environment._ensure()
        client = clients.get_glance_client()
        glance.create_or_find_kernel_and_ramdisk(
            client, args.kernel, args.ramdisk, kernel_path=args.kernel_file,
            ramdisk_path=args.ramdisk_file)
    except Exception:
        logging.exception("Unexpected error during command execution")
        return 1
    return 0
示例#7
0
def main():
    args = parse_args()
    environment._configure_logging(args)

    try:
        environment._ensure()
        with open(args.json, 'r') as jsonfile:
            network_desc = json.load(jsonfile)

        neutron_client = _clients.get_neutron_client()
        keystone_client = _clients.get_keystone_client()
        neutron.initialize_neutron(network_desc,
                                   neutron_client=neutron_client,
                                   keystone_client=keystone_client)
    except Exception:
        logging.exception("Unexpected error during command execution")
        return 1
    return 0
def main():
    args = parse_args()
    environment._configure_logging(args)

    try:
        with open(args.nodes, 'r') as node_file:
            nodes_list = json.load(node_file)
        environment._ensure()

        keystone_client = _clients.get_keystone_client()
        if nodes.using_ironic(keystone=keystone_client):
            client = _clients.get_ironic_client()
        else:
            client = _clients.get_nova_bm_client()

        nodes.register_all_nodes(
            args.service_host, nodes_list, client=client, remove=args.remove)
    except Exception:
        logging.exception("Unexpected error during command execution")
        return 1
    return 0
示例#9
0
def main():
    args = parse_args()
    environment._configure_logging(args)

    try:
        with open(args.nodes, 'r') as node_file:
            nodes_list = json.load(node_file)
        environment._ensure()

        keystone_client = _clients.get_keystone_client()
        glance_client = _clients.get_glance_client()
        client = _clients.get_ironic_client()

        nodes.register_all_nodes(
            args.service_host, nodes_list, client=client, remove=args.remove,
            blocking=True, keystone_client=keystone_client,
            glance_client=glance_client, kernel_name=args.kernel_name,
            ramdisk_name=args.ramdisk_name)
    except Exception:
        logging.exception("Unexpected error during command execution")
        return 1
    return 0
示例#10
0
def main():
    args = parse_args()
    environment._configure_logging(args)

    try:
        with open(args.nodes, 'r') as node_file:
            nodes_list = json.load(node_file)
        environment._ensure()

        keystone_client = _clients.get_keystone_client()
        if nodes.using_ironic(keystone=keystone_client):
            client = _clients.get_ironic_client()
        else:
            client = _clients.get_nova_bm_client()

        nodes.register_all_nodes(args.service_host,
                                 nodes_list,
                                 client=client,
                                 remove=args.remove)
    except Exception:
        logging.exception("Unexpected error during command execution")
        return 1
    return 0
 def test_ensure_environment_missing_none(self):
     self.assertIs(None, environment._ensure())
 def test_ensure_environment_missing_username(self):
     message = "OS_USERNAME environment variable is required to be set."
     with testtools.ExpectedException(exception.MissingEnvironment,
                                      message):
         environment._ensure()
 def test_ensure_environment_missing_all(self):
     message = ("OS_AUTH_URL, OS_PASSWORD, OS_TENANT_NAME, OS_USERNAME "
                "environment variables are required to be set.")
     with testtools.ExpectedException(exception.MissingEnvironment,
                                      message):
         environment._ensure()
示例#14
0
 def test_ensure_environment_missing_none(self):
     self.assertIs(None, environment._ensure())
示例#15
0
 def test_ensure_environment_missing_username(self):
     message = "OS_USERNAME environment variable is required to be set."
     with testtools.ExpectedException(exception.MissingEnvironment,
                                      message):
         environment._ensure()
示例#16
0
 def test_ensure_environment_missing_all(self):
     message = ("OS_AUTH_URL, OS_PASSWORD, OS_TENANT_NAME, OS_USERNAME "
                "environment variables are required to be set.")
     with testtools.ExpectedException(exception.MissingEnvironment,
                                      message):
         environment._ensure()