fix openstack metadata
Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru>
This commit is contained in:
parent
f33a90587f
commit
002446413d
2
build
2
build
@ -14,7 +14,7 @@ mkdir -p $GOBIN
|
|||||||
mkdir -p $GOPATH
|
mkdir -p $GOPATH
|
||||||
mkdir -p bin tmp
|
mkdir -p bin tmp
|
||||||
|
|
||||||
go version | grep -q go1.5
|
go version | grep -q go
|
||||||
|
|
||||||
if [ "x$?" != "x0" ]; then
|
if [ "x$?" != "x0" ]; then
|
||||||
export GOROOT=$(pwd)/goroot
|
export GOROOT=$(pwd)/goroot
|
||||||
|
@ -31,6 +31,7 @@ import (
|
|||||||
"github.com/coreos/coreos-cloudinit/datasource"
|
"github.com/coreos/coreos-cloudinit/datasource"
|
||||||
"github.com/coreos/coreos-cloudinit/datasource/configdrive"
|
"github.com/coreos/coreos-cloudinit/datasource/configdrive"
|
||||||
"github.com/coreos/coreos-cloudinit/datasource/file"
|
"github.com/coreos/coreos-cloudinit/datasource/file"
|
||||||
|
"github.com/coreos/coreos-cloudinit/datasource/metadata/openstack"
|
||||||
"github.com/coreos/coreos-cloudinit/datasource/metadata/digitalocean"
|
"github.com/coreos/coreos-cloudinit/datasource/metadata/digitalocean"
|
||||||
"github.com/coreos/coreos-cloudinit/datasource/metadata/ec2"
|
"github.com/coreos/coreos-cloudinit/datasource/metadata/ec2"
|
||||||
"github.com/coreos/coreos-cloudinit/datasource/metadata/packet"
|
"github.com/coreos/coreos-cloudinit/datasource/metadata/packet"
|
||||||
@ -61,6 +62,7 @@ var (
|
|||||||
waagent string
|
waagent string
|
||||||
metadataService bool
|
metadataService bool
|
||||||
ec2MetadataService string
|
ec2MetadataService string
|
||||||
|
openstackMetadataService string
|
||||||
// cloudSigmaMetadataService bool
|
// cloudSigmaMetadataService bool
|
||||||
digitalOceanMetadataService string
|
digitalOceanMetadataService string
|
||||||
packetMetadataService string
|
packetMetadataService string
|
||||||
@ -88,7 +90,7 @@ func init() {
|
|||||||
flag.StringVar(&flags.sources.ec2MetadataService, "from-ec2-metadata", "", "Download EC2 data from the provided url")
|
flag.StringVar(&flags.sources.ec2MetadataService, "from-ec2-metadata", "", "Download EC2 data from the provided url")
|
||||||
// flag.BoolVar(&flags.sources.cloudSigmaMetadataService, "from-cloudsigma-metadata", false, "Download data from CloudSigma server context")
|
// flag.BoolVar(&flags.sources.cloudSigmaMetadataService, "from-cloudsigma-metadata", false, "Download data from CloudSigma server context")
|
||||||
flag.StringVar(&flags.sources.digitalOceanMetadataService, "from-digitalocean-metadata", "", "Download DigitalOcean data from the provided url")
|
flag.StringVar(&flags.sources.digitalOceanMetadataService, "from-digitalocean-metadata", "", "Download DigitalOcean data from the provided url")
|
||||||
flag.StringVar(&flags.sources.ec2MetadataService, "from-openstack-metadata", "", "Download OpenStack data from the provided url")
|
flag.StringVar(&flags.sources.openstackMetadataService, "from-openstack-metadata", "", "Download OpenStack data from the provided url")
|
||||||
flag.StringVar(&flags.sources.packetMetadataService, "from-packet-metadata", "", "Download Packet data from metadata service")
|
flag.StringVar(&flags.sources.packetMetadataService, "from-packet-metadata", "", "Download Packet data from metadata service")
|
||||||
flag.StringVar(&flags.sources.url, "from-url", "", "Download user-data from provided url")
|
flag.StringVar(&flags.sources.url, "from-url", "", "Download user-data from provided url")
|
||||||
flag.BoolVar(&flags.sources.procCmdLine, "from-proc-cmdline", false, fmt.Sprintf("Parse %s for '%s=<url>', using the cloud-config served by an HTTP GET to <url>", proc_cmdline.ProcCmdlineLocation, proc_cmdline.ProcCmdlineCloudConfigFlag))
|
flag.BoolVar(&flags.sources.procCmdLine, "from-proc-cmdline", false, fmt.Sprintf("Parse %s for '%s=<url>', using the cloud-config served by an HTTP GET to <url>", proc_cmdline.ProcCmdlineLocation, proc_cmdline.ProcCmdlineCloudConfigFlag))
|
||||||
@ -188,10 +190,10 @@ func main() {
|
|||||||
|
|
||||||
dss := getDatasources()
|
dss := getDatasources()
|
||||||
if len(dss) == 0 {
|
if len(dss) == 0 {
|
||||||
fmt.Println("Provide at least one of --from-file, --from-configdrive, --from-ec2-metadata, --from-cloudsigma-metadata, --from-packet-metadata, --from-digitalocean-metadata, --from-vmware-guestinfo, --from-waagent, --from-url or --from-proc-cmdline")
|
fmt.Println("Provide at least one of --from-file, --from-configdrive, --from-openstack-metadata, --from-ec2-metadata, --from-cloudsigma-metadata, --from-packet-metadata, --from-digitalocean-metadata, --from-vmware-guestinfo, --from-waagent, --from-url or --from-proc-cmdline")
|
||||||
os.Exit(2)
|
os.Exit(2)
|
||||||
}
|
}
|
||||||
|
fmt.Printf("%#+v\n", dss)
|
||||||
ds := selectDatasource(dss)
|
ds := selectDatasource(dss)
|
||||||
if ds == nil {
|
if ds == nil {
|
||||||
log.Println("No datasources available in time")
|
log.Println("No datasources available in time")
|
||||||
@ -332,6 +334,9 @@ func getDatasources() []datasource.Datasource {
|
|||||||
}
|
}
|
||||||
if flags.sources.metadataService {
|
if flags.sources.metadataService {
|
||||||
dss = append(dss, ec2.NewDatasource(ec2.DefaultAddress))
|
dss = append(dss, ec2.NewDatasource(ec2.DefaultAddress))
|
||||||
|
}
|
||||||
|
if flags.sources.openstackMetadataService != "" {
|
||||||
|
dss = append(dss, openstack.NewDatasource(flags.sources.openstackMetadataService))
|
||||||
}
|
}
|
||||||
if flags.sources.ec2MetadataService != "" {
|
if flags.sources.ec2MetadataService != "" {
|
||||||
dss = append(dss, ec2.NewDatasource(flags.sources.ec2MetadataService))
|
dss = append(dss, ec2.NewDatasource(flags.sources.ec2MetadataService))
|
||||||
|
Loading…
Reference in New Issue
Block a user