From 6884511f05febf2366c18931f1d1c87ced0c93fe Mon Sep 17 00:00:00 2001 From: Christopher Boumenot Date: Thu, 15 Jun 2017 23:32:19 +0000 Subject: [PATCH 1/2] Support for XML extensions --- main.go | 5 ++++- unpublish.go | 16 ++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index f667ba2..2bf2c0d 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..7a9ceb9 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) } From 9ddfa600dba8186b5268d8a6308bd39ee32171b6 Mon Sep 17 00:00:00 2001 From: Christopher Boumenot Date: Fri, 23 Jun 2017 02:42:37 +0000 Subject: [PATCH 2/2] go fmt . --- main.go | 6 +++--- unpublish.go | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/main.go b/main.go index 2bf2c0d..2766929 100644 --- a/main.go +++ b/main.go @@ -72,9 +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"} + flIsXMLExtension = cli.BoolFlag{ + Name: "is-xml-extension", + Usage: "Set if this is an XML extension, i.e. PaaS"} ) func main() { diff --git a/unpublish.go b/unpublish.go index 7a9ceb9..989e366 100644 --- a/unpublish.go +++ b/unpublish.go @@ -16,8 +16,8 @@ func unpublishVersion(c *cli.Context) { Name: checkFlag(c, flName.Name), Version: checkFlag(c, flVersion.Name)} - isXMLExtension := c.Bool(flIsXMLExtension.Name) - buf := bytes.NewBufferString(` + isXMLExtension := c.Bool(flIsXMLExtension.Name) + buf := bytes.NewBufferString(` {{.Namespace}} @@ -26,13 +26,13 @@ func unpublishVersion(c *cli.Context) { true `) - // All extension should be a JSON extension. The biggest offenders are - // PaaS extensions. - if !isXMLExtension { - buf.WriteString("true") - } + // All extension should be a JSON extension. The biggest offenders are + // PaaS extensions. + if !isXMLExtension { + buf.WriteString("true") + } - buf.WriteString("") + buf.WriteString("") tpl, err := template.New("unregisterManifest").Parse(buf.String()) if err != nil { log.Fatalf("template parse error: %v", err)