Beispiel #1
0
func InspectCmd(name string) error {
	if !Exists(name) {
		return fmt.Errorf("Node %s does not exist", name)
	}

	node, err := Read(name)
	if err != nil {
		return err
	}

	_, err = node.Client()
	if err != nil {
		fmt.Printf(
			"%s%s%s%s%s\n",
			utils.FillString(name, FILL_SIZE),
			utils.FillString("offline", FILL_SIZE),
			utils.FillString(node.Url, FILL_SIZE),
			utils.FillString(node.Cluster, FILL_SIZE),
			node.Tags)
	} else {
		fmt.Printf(
			"%s%s%s%s%s\n",
			utils.FillString(name, FILL_SIZE),
			utils.FillString("online", FILL_SIZE),
			utils.FillString(node.Url, FILL_SIZE),
			utils.FillString(node.Cluster, FILL_SIZE),
			node.Tags)
	}
	return nil
}
Beispiel #2
0
func ListCmd() error {
	stacks, err := List()
	if err != nil {
		return err
	}
	if len(stacks) == 0 {
		fmt.Printf("There are not stacks\n")
		return nil
	}

	fmt.Printf("%sLAST OPERATION\n", utils.FillString("NAME", FILL_SIZE))
	for _, stack := range stacks {
		fmt.Printf("%s\n", utils.FillString(stack.Name, FILL_SIZE))
	}
	return nil
}
Beispiel #3
0
func InspectCmd(name string) error {
	if !Exists(name) {
		return fmt.Errorf("Image %s does not exist", name)
	}

	image, err := Read(name)
	if err != nil {
		return err
	}

	fmt.Printf(
		"%s%s%s\n",
		utils.FillString(image.Name, FILL_SIZE),
		utils.FillString(image.User, FILL_SIZE),
		utils.FillString(image.Url, FILL_SIZE))
	return nil
}
Beispiel #4
0
func ListCmd() error {
	images, err := List()
	if err != nil {
		return err
	}
	if len(images) == 0 {
		fmt.Printf("There are not private images\n")
		return nil
	}

	fmt.Printf(
		"%s%sURL\n",
		utils.FillString("NAME", FILL_SIZE),
		utils.FillString("USER", FILL_SIZE))
	for _, image := range images {
		err = InspectCmd(image)
		if err != nil {
			return err
		}
	}
	return nil
}
Beispiel #5
0
func ListCmd() error {
	nodes, err := List()
	if err != nil {
		return err
	}
	if len(nodes) == 0 {
		fmt.Printf("There are not nodes\n")
		return nil
	}

	fmt.Printf(
		"%s%s%s%sTAGS\n",
		utils.FillString("NAME", FILL_SIZE),
		utils.FillString("STATE", FILL_SIZE),
		utils.FillString("URL", FILL_SIZE),
		utils.FillString("CLUSTER", FILL_SIZE))
	for _, node := range nodes {
		err = InspectCmd(node)
		if err != nil {
			return err
		}
	}
	return nil
}
Beispiel #6
0
func ListCmd() error {
	clusters, err := List()
	if err != nil {
		return err
	}
	if len(clusters) == 0 {
		fmt.Printf("There are not clusters\n")
		return nil
	}

	fmt.Printf(
		"%s%s%sCLEANUP\n",
		utils.FillString("NAME", FILL_SIZE),
		utils.FillString("CONSUL", FILL_SIZE),
		utils.FillString("WEAVE", FILL_SIZE),
		utils.FillString("WEAVE-PWD", FILL_SIZE))
	for _, cluster := range clusters {
		err = InspectCmd(cluster)
		if err != nil {
			return err
		}
	}
	return nil
}