Skip to content

Commit bb42946

Browse files
- Added Packer plugin version to User-Agent string
- Updated version initialization
1 parent a4072cb commit bb42946

3 files changed

Lines changed: 10 additions & 4 deletions

File tree

.goreleaser.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ env:
55
- CGO_ENABLED=0
66
before:
77
hooks:
8-
# TODO(ddelnano): for now there aren't tests to run
8+
# TODO: Add tests
99
# - go test ./...
1010
# As part of the release doc files are included as a separate deliverable for
1111
# consumption by Packer.io. To include a separate docs.zip uncomment the following command.

builder/xenserver/common/client.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"log"
88

99
"xenapi"
10+
version "github.com/xenserver/packer-plugin-xenserver/version"
1011
)
1112

1213
type VDIType int
@@ -285,10 +286,12 @@ func (c Connection) GetSession() *xenapi.Session {
285286
}
286287

287288
func NewXenAPIClient(host, username, password string) (*Connection, error) {
289+
log.Printf("XenServer Packer Plugin Version: %s", version.PluginVersion.FormattedVersion())
290+
288291
session := xenapi.NewSession(&xenapi.ClientOpts{
289292
URL: "http://" + host,
290293
Headers: map[string]string{
291-
"User-Agent": "XenPacker",
294+
"User-Agent": fmt.Sprintf("XenServerPacker/%s", version.PluginVersion.FormattedVersion()),
292295
},
293296
})
294297

version/version.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@ import (
66

77
var (
88
// Version is the main version number that is being run at the moment.
9-
Version = "v0.9.0"
9+
Version = "v0.9.1"
1010

1111
// VersionPrerelease is A pre-release marker for the Version. If this is ""
1212
// (empty string) then it means that it is a final release. Otherwise, this
1313
// is a pre-release such as "dev" (in development), "beta", "rc1", etc.
1414
VersionPrerelease = ""
1515

16+
// Version Meta Data
17+
VersionMetadata = ""
18+
1619
// PluginVersion is used by the plugin set to allow Packer to recognize
1720
// what version this plugin is.
18-
PluginVersion = version.InitializePluginVersion(Version, VersionPrerelease)
21+
PluginVersion = version.NewPluginVersion(Version, VersionPrerelease, VersionMetadata)
1922
)

0 commit comments

Comments
 (0)