MCPcopy Index your code
hub / github.com/linuxkit/linuxkit / pushOpenstackCmd

Function pushOpenstackCmd

src/cmd/linuxkit/push_openstack.go:73–103  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

71}
72
73func pushOpenstackCmd() *cobra.Command {
74 var (
75 imageName string
76 )
77 cmd := &cobra.Command{
78 Use: "openstack",
79 Short: "push image to OpenStack Image store (Glance)",
80 Long: `Push image to OpenStack Image store (Glance).
81 First argument specifies the path to a disk file.
82 `,
83 Args: cobra.ExactArgs(1),
84 RunE: func(cmd *cobra.Command, args []string) error {
85 path := args[0]
86
87 // Check that the file both exists, and can be read
88 checkFile(path)
89
90 client, err := clientconfig.NewServiceClient("image", nil)
91 if err != nil {
92 log.Fatalf("Error connecting to your OpenStack cloud: %s", err)
93 }
94
95 createOpenStackImage(path, imageName, client)
96 return nil
97 },
98 }
99
100 cmd.Flags().StringVar(&imageName, "img-name", "", "A unique name for the image, if blank the filename will be used")
101
102 return cmd
103}

Callers 1

pushCmdFunction · 0.85

Calls 2

checkFileFunction · 0.85
createOpenStackImageFunction · 0.85

Tested by

no test coverage detected