diff --git a/main.go b/main.go
index 55c6efa..bddc223 100644
--- a/main.go
+++ b/main.go
@@ -217,11 +217,11 @@ func updateHtml(htmlContent string, heading string, newTable string) string {
// Find the h2 heading that matches our heading passed to the function
doc.Find("h2").Each(func(i int, s *goquery.Selection) {
if s.Text() == heading {
+ fmt.Printf("Found h2 element matching '%s'\n", heading)
// Find the table that follows this h2 heading
table := s.NextFiltered("table")
// Replace the table with a new table
- //newTableHTML := "
"
newTable, _ := goquery.NewDocumentFromReader(strings.NewReader(newTable))
table.ReplaceWithSelection(newTable.Selection)
}
@@ -244,7 +244,6 @@ func updateHtml(htmlContent string, heading string, newTable string) string {
func main() {
// Command line flags
-
vURL := flag.String("url", "", "The URL of a vCenter server, eg https://server.domain.example/sdk")
vUser := flag.String("user", "", "The username to use when connecting to vCenter")
vPass := flag.String("password", "", "The password to use when connecting to vCenter")
@@ -288,6 +287,7 @@ func main() {
log.Printf("Updated vCenter URL to '%v'\n", u)
}
}
+ vCenterHostname := u.Host
log.Printf("Connecting to vCenter %s\n", u)
u.User = url.UserPassword(*vUser, *vPass)
@@ -340,6 +340,7 @@ func main() {
}
fmt.Printf("%+v\n", c)
fmt.Printf("Current version number : '%d'\n", c.Version.Number)
+ newVersion := c.Version.Number + 1
// Generate new content for confluence
@@ -347,7 +348,7 @@ func main() {
//dummyTable := "VM Name | Cluster Name |
---|
VM1 | Cluster1 |
"
newTable := generateBusSharingTable()
- newContent := updateHtml(c.Body.Storage.Value, "wsdc-vc-npr.srv.westpac.com.au", newTable)
+ newContent := updateHtml(c.Body.Storage.Value, vCenterHostname, newTable)
fmt.Printf("New Content: %v\n", newContent)
data := &goconfluence.Content{
@@ -361,7 +362,7 @@ func main() {
},
},
Version: &goconfluence.Version{
- Number: 6,
+ Number: newVersion,
},
Space: &goconfluence.Space{
Key: *cSpaceKey,