diff --git a/main/compile.go b/main/compile.go index ef18ea37e..cf84698df 100644 --- a/main/compile.go +++ b/main/compile.go @@ -10,6 +10,7 @@ import ( "github.com/cloudfoundry/bosh-agent/app" "github.com/cloudfoundry/bosh-agent/releasetarball" "github.com/cloudfoundry/bosh-agent/settings/directories" + "github.com/cloudfoundry/bosh-agent/stemcellmetadata" ) func compileTarball(command string, args []string) { @@ -22,7 +23,7 @@ func compileTarball(command string, args []string) { log.Fatal(err) } - stemcellOS, stemcellName, stemcellVersion, err := readStemcellSlug() + stemcellOS, stemcellName, stemcellVersion, err := stemcellmetadata.SlugParts() if err != nil { log.Fatal(err) } diff --git a/main/stemcell.go b/main/stemcell.go deleted file mode 100644 index 406443ba2..000000000 --- a/main/stemcell.go +++ /dev/null @@ -1,11 +0,0 @@ -//go:build !linux - -package main - -import ( - "fmt" -) - -func readStemcellSlug() (string, string, string, error) { - return "", "", "", fmt.Errorf("readStemcellSlug: not implemented") -} diff --git a/stemcellmetadata/slug.go b/stemcellmetadata/slug.go new file mode 100644 index 000000000..20036aa0c --- /dev/null +++ b/stemcellmetadata/slug.go @@ -0,0 +1,10 @@ +//go:build !linux + +package stemcellmetadata + +import "log" + +func SlugParts() (_ string, _ string, _ string, _ error) { + log.Fatal("func readStemcellSlug (in package stemcellmetadata) is not implemented for GOOS != linux") + return +} diff --git a/main/stemcell_linux.go b/stemcellmetadata/slug_linux.go similarity index 95% rename from main/stemcell_linux.go rename to stemcellmetadata/slug_linux.go index 52aa17de5..e75e6d76c 100644 --- a/main/stemcell_linux.go +++ b/stemcellmetadata/slug_linux.go @@ -1,4 +1,4 @@ -package main +package stemcellmetadata import ( "bufio" @@ -10,7 +10,7 @@ import ( "strings" ) -func readStemcellSlug() (string, string, string, error) { +func SlugParts() (string, string, string, error) { stemcellVersionBuf, err := os.ReadFile("/var/vcap/bosh/etc/stemcell_version") if err != nil { return "", "", "", err