diff --git a/main.go b/main.go index f667ba2..2766929 100644 --- a/main.go +++ b/main.go @@ -72,6 +72,9 @@ var ( flJSON = cli.BoolFlag{ Name: "json", Usage: "Print output as JSON"} + flIsXMLExtension = cli.BoolFlag{ + Name: "is-xml-extension", + Usage: "Set if this is an XML extension, i.e. PaaS"} ) func main() { @@ -139,7 +142,7 @@ func main() { Action: replicationStatus}, {Name: "unpublish-version", Usage: "Marks the specified version of the extension internal. Does not delete.", - Flags: []cli.Flag{flMgtURL, flSubsID, flSubsCert, flNamespace, flName, flVersion}, + Flags: []cli.Flag{flMgtURL, flSubsID, flSubsCert, flNamespace, flName, flVersion, flIsXMLExtension}, Action: unpublishVersion}, {Name: "delete-version", Usage: "Deletes the extension version. It should be unpublished first.", diff --git a/unpublish.go b/unpublish.go index 2b78e98..989e366 100644 --- a/unpublish.go +++ b/unpublish.go @@ -16,16 +16,24 @@ func unpublishVersion(c *cli.Context) { Name: checkFlag(c, flName.Name), Version: checkFlag(c, flVersion.Name)} - unpublishManifestXML := ` + isXMLExtension := c.Bool(flIsXMLExtension.Name) + buf := bytes.NewBufferString(` {{.Namespace}} {{.Name}} {{.Version}} true - true -` - tpl, err := template.New("unregisterManifest").Parse(unpublishManifestXML) +`) + + // All extension should be a JSON extension. The biggest offenders are + // PaaS extensions. + if !isXMLExtension { + buf.WriteString("true") + } + + buf.WriteString("") + tpl, err := template.New("unregisterManifest").Parse(buf.String()) if err != nil { log.Fatalf("template parse error: %v", err) }