Beispiel #1
0
// Add most hosts in batch mode
func addHosts(c *cli.Context) error {
	err := checkArgNum(c.Args(), 1, "system addHosts <file>")
	if err != nil {
		return err
	}
	file := c.Args().First()
	dcMap, err := manifest.LoadInstallation(file)
	if err != nil {
		return err
	}

	client.Esxclient, err = client.GetClient(false)
	if err != nil {
		return err
	}

	deployments, err := client.Esxclient.Deployments.GetAll()
	deploymentID := deployments.Items[0].ID

	// Create Hosts
	err = createHostsInBatch(dcMap, deploymentID)
	if err != nil {
		return err
	}

	return nil
}
Beispiel #2
0
// Deploy Photon Controller based on DC_map
func deploy(c *cli.Context) error {
	err := checkArgNum(c.Args(), 1, "system deploy <file>")
	if err != nil {
		return err
	}
	file := c.Args().First()
	dcMap, err := manifest.LoadInstallation(file)
	if err != nil {
		return err
	}

	client.Esxclient, err = client.GetClient(false)
	if err != nil {
		return err
	}

	deploymentID, err := createDeploymentFromDcMap(dcMap)
	if err != nil {
		return err
	}

	// Create Hosts
	err = createHostsFromDcMap(dcMap, deploymentID)
	if err != nil {
		return err
	}

	// Deploy
	err = doDeploy(dcMap, deploymentID)
	if err != nil {
		return err
	}

	return nil
}