|
|
@ -83,7 +83,7 @@ var usage = func() {
|
|
|
|
fmt.Fprintln(os.Stderr)
|
|
|
|
fmt.Fprintln(os.Stderr)
|
|
|
|
fmt.Fprintln(os.Stderr, "--stdin requires a file name and either the file contents or a tar archive containing the named file.")
|
|
|
|
fmt.Fprintln(os.Stderr, "--stdin requires a file name and either the file contents or a tar archive containing the named file.")
|
|
|
|
fmt.Fprintln(os.Stderr, " a tar archive may include any additional files referenced directly or indirectly by the named file.")
|
|
|
|
fmt.Fprintln(os.Stderr, " a tar archive may include any additional files referenced directly or indirectly by the named file.")
|
|
|
|
panic("\n")
|
|
|
|
os.Exit(0)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func getGithubCredential() *common.RegistryCredential {
|
|
|
|
func getGithubCredential() *common.RegistryCredential {
|
|
|
@ -120,6 +120,10 @@ func getGithubCredential() *common.RegistryCredential {
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
|
|
|
|
flag.Usage = usage
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
func main() {
|
|
|
|
defer func() {
|
|
|
|
defer func() {
|
|
|
|
result := recover()
|
|
|
|
result := recover()
|
|
|
@ -136,7 +140,6 @@ func execute() {
|
|
|
|
flag.Parse()
|
|
|
|
flag.Parse()
|
|
|
|
args := flag.Args()
|
|
|
|
args := flag.Args()
|
|
|
|
if len(args) < 1 {
|
|
|
|
if len(args) < 1 {
|
|
|
|
fmt.Fprintln(os.Stderr, "No command supplied")
|
|
|
|
|
|
|
|
usage()
|
|
|
|
usage()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -173,7 +176,7 @@ func execute() {
|
|
|
|
case "get":
|
|
|
|
case "get":
|
|
|
|
if len(args) < 2 {
|
|
|
|
if len(args) < 2 {
|
|
|
|
fmt.Fprintln(os.Stderr, "No deployment name supplied")
|
|
|
|
fmt.Fprintln(os.Stderr, "No deployment name supplied")
|
|
|
|
usage()
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
path := fmt.Sprintf("deployments/%s", args[1])
|
|
|
|
path := fmt.Sprintf("deployments/%s", args[1])
|
|
|
@ -183,14 +186,14 @@ func execute() {
|
|
|
|
msg := "Must specify manifest in the form <deployment>/<manifest> or <deployment> to list."
|
|
|
|
msg := "Must specify manifest in the form <deployment>/<manifest> or <deployment> to list."
|
|
|
|
if len(args) < 2 {
|
|
|
|
if len(args) < 2 {
|
|
|
|
fmt.Fprintln(os.Stderr, msg)
|
|
|
|
fmt.Fprintln(os.Stderr, msg)
|
|
|
|
usage()
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
s := strings.Split(args[1], "/")
|
|
|
|
s := strings.Split(args[1], "/")
|
|
|
|
ls := len(s)
|
|
|
|
ls := len(s)
|
|
|
|
if ls < 1 || ls > 2 {
|
|
|
|
if ls < 1 || ls > 2 {
|
|
|
|
fmt.Fprintln(os.Stderr, fmt.Sprintf("Invalid manifest (%s), %s", args[1], msg))
|
|
|
|
fmt.Fprintln(os.Stderr, fmt.Sprintf("Invalid manifest (%s), %s", args[1], msg))
|
|
|
|
usage()
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
path := fmt.Sprintf("deployments/%s/manifests", s[0])
|
|
|
|
path := fmt.Sprintf("deployments/%s/manifests", s[0])
|
|
|
@ -203,7 +206,7 @@ func execute() {
|
|
|
|
case "delete":
|
|
|
|
case "delete":
|
|
|
|
if len(args) < 2 {
|
|
|
|
if len(args) < 2 {
|
|
|
|
fmt.Fprintln(os.Stderr, "No deployment name supplied")
|
|
|
|
fmt.Fprintln(os.Stderr, "No deployment name supplied")
|
|
|
|
usage()
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
path := fmt.Sprintf("deployments/%s", args[1])
|
|
|
|
path := fmt.Sprintf("deployments/%s", args[1])
|
|
|
@ -219,7 +222,7 @@ func execute() {
|
|
|
|
case "deployed-instances":
|
|
|
|
case "deployed-instances":
|
|
|
|
if len(args) < 2 {
|
|
|
|
if len(args) < 2 {
|
|
|
|
fmt.Fprintln(os.Stderr, "No type name supplied")
|
|
|
|
fmt.Fprintln(os.Stderr, "No type name supplied")
|
|
|
|
usage()
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
tUrls := getDownloadURLs(args[1])
|
|
|
|
tUrls := getDownloadURLs(args[1])
|
|
|
@ -237,7 +240,9 @@ func execute() {
|
|
|
|
case "registries":
|
|
|
|
case "registries":
|
|
|
|
callService("registries", "GET", "list registries", nil)
|
|
|
|
callService("registries", "GET", "list registries", nil)
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
usage()
|
|
|
|
fmt.Fprintf(os.Stderr, "Error: unknown command '%s' for 'dm'\n", args[0])
|
|
|
|
|
|
|
|
fmt.Fprintln(os.Stderr, "Run 'dm --help' for usage")
|
|
|
|
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -292,7 +297,7 @@ func callHttp(path, method, action string, reader io.ReadCloser) string {
|
|
|
|
func describeType(args []string) {
|
|
|
|
func describeType(args []string) {
|
|
|
|
if len(args) != 2 {
|
|
|
|
if len(args) != 2 {
|
|
|
|
fmt.Fprintln(os.Stderr, "No type name or URL supplied")
|
|
|
|
fmt.Fprintln(os.Stderr, "No type name or URL supplied")
|
|
|
|
usage()
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
tUrls := getDownloadURLs(args[1])
|
|
|
|
tUrls := getDownloadURLs(args[1])
|
|
|
@ -320,12 +325,12 @@ func loadTemplate(args []string) *common.Template {
|
|
|
|
var err error
|
|
|
|
var err error
|
|
|
|
if len(args) < 2 {
|
|
|
|
if len(args) < 2 {
|
|
|
|
fmt.Fprintln(os.Stderr, "No template name or configuration(s) supplied")
|
|
|
|
fmt.Fprintln(os.Stderr, "No template name or configuration(s) supplied")
|
|
|
|
usage()
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if *stdin {
|
|
|
|
if *stdin {
|
|
|
|
if len(args) < 2 {
|
|
|
|
if len(args) < 2 {
|
|
|
|
usage()
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
input, err := ioutil.ReadAll(os.Stdin)
|
|
|
|
input, err := ioutil.ReadAll(os.Stdin)
|
|
|
|