fix build

Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru>
This commit is contained in:
Василий Толстов 2015-11-09 09:08:44 +00:00
parent d407b82968
commit 414957d985
55 changed files with 35 additions and 77 deletions

38
Godeps/Godeps.json generated
View File

@ -1,38 +0,0 @@
{
"ImportPath": "github.com/coreos/coreos-cloudinit",
"GoVersion": "go1.3.3",
"Packages": [
"./..."
],
"Deps": [
{
"ImportPath": "github.com/cloudsigma/cepgo",
"Rev": "1bfc4895bf5c4d3b599f3f6ee142299488c8739b"
},
{
"ImportPath": "github.com/coreos/go-systemd/dbus",
"Rev": "4fbc5060a317b142e6c7bfbedb65596d5f0ab99b"
},
{
"ImportPath": "github.com/coreos/yaml",
"Rev": "6b16a5714269b2f70720a45406b1babd947a17ef"
},
{
"ImportPath": "github.com/dotcloud/docker/pkg/netlink",
"Comment": "v0.11.1-359-g55d41c3e21e1",
"Rev": "55d41c3e21e1593b944c06196ffb2ac57ab7f653"
},
{
"ImportPath": "github.com/guelfey/go.dbus",
"Rev": "f6a3a2366cc39b8479cadc499d3c735fb10fbdda"
},
{
"ImportPath": "github.com/tarm/goserial",
"Rev": "cdabc8d44e8e84f58f18074ae44337e1f2f375b9"
},
{
"ImportPath": "github.com/sigma/vmw-guestinfo",
"Rev": "de573afc542e0268fe8478d46e237fad9d6f7aec"
}
]
}

2
build
View File

@ -3,7 +3,7 @@
ORG_PATH="github.com/coreos" ORG_PATH="github.com/coreos"
REPO_PATH="${ORG_PATH}/coreos-cloudinit" REPO_PATH="${ORG_PATH}/coreos-cloudinit"
VERSION=$(git describe --tags) VERSION=$(git describe --tags)
GLDFLAGS="-X main.version \"${VERSION}\"" GLDFLAGS="-X main.version=${VERSION}"
rm -rf bin tmp rm -rf bin tmp

View File

@ -33,16 +33,16 @@ import (
"github.com/coreos/coreos-cloudinit/datasource/metadata/packet" "github.com/coreos/coreos-cloudinit/datasource/metadata/packet"
"github.com/coreos/coreos-cloudinit/datasource/proc_cmdline" "github.com/coreos/coreos-cloudinit/datasource/proc_cmdline"
"github.com/coreos/coreos-cloudinit/datasource/url" "github.com/coreos/coreos-cloudinit/datasource/url"
"github.com/coreos/coreos-cloudinit/datasource/vmware"
// "github.com/coreos/coreos-cloudinit/datasource/vmware"
"github.com/coreos/coreos-cloudinit/datasource/waagent" "github.com/coreos/coreos-cloudinit/datasource/waagent"
"github.com/coreos/coreos-cloudinit/initialize" "github.com/coreos/coreos-cloudinit/initialize"
"github.com/coreos/coreos-cloudinit/network" "github.com/coreos/coreos-cloudinit/network"
"github.com/coreos/coreos-cloudinit/pkg" "github.com/coreos/coreos-cloudinit/pkg"
"github.com/coreos/coreos-cloudinit/system" "github.com/coreos/coreos-cloudinit/system"
"github.com/coreos/coreos-cloudinit/datasource/metadata/openstack"
) )
const ( var (
datasourceInterval = 100 * time.Millisecond datasourceInterval = 100 * time.Millisecond
datasourceMaxInterval = 30 * time.Second datasourceMaxInterval = 30 * time.Second
datasourceTimeout = 5 * time.Minute datasourceTimeout = 5 * time.Minute
@ -63,7 +63,7 @@ var (
packetMetadataService string packetMetadataService string
url string url string
procCmdLine bool procCmdLine bool
vmware bool // vmware bool
} }
convertNetconf string convertNetconf string
workspace string workspace string
@ -85,11 +85,11 @@ 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.openstackMetadataService, "from-openstack-metadata", "", "Download OpenStack data from the provided url") flag.StringVar(&flags.sources.ec2MetadataService, "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))
flag.BoolVar(&flags.sources.vmware, "from-vmware-guestinfo", false, "Read data from VMware guestinfo") // flag.BoolVar(&flags.sources.vmware, "from-vmware-guestinfo", false, "Read data from VMware guestinfo")
flag.StringVar(&flags.oem, "oem", "", "Use the settings specific to the provided OEM") flag.StringVar(&flags.oem, "oem", "", "Use the settings specific to the provided OEM")
flag.StringVar(&flags.convertNetconf, "convert-netconf", "", "Read the network config provided in cloud-drive and translate it from the specified format into networkd unit files") flag.StringVar(&flags.convertNetconf, "convert-netconf", "", "Read the network config provided in cloud-drive and translate it from the specified format into networkd unit files")
flag.StringVar(&flags.workspace, "workspace", "/var/lib/cloudinit", "Base directory where cloudinit should use to store data") flag.StringVar(&flags.workspace, "workspace", "/var/lib/cloudinit", "Base directory where cloudinit should use to store data")
@ -97,7 +97,6 @@ func init() {
flag.BoolVar(&flags.validate, "validate", false, "[EXPERIMENTAL] Validate the user-data but do not apply it to the system") flag.BoolVar(&flags.validate, "validate", false, "[EXPERIMENTAL] Validate the user-data but do not apply it to the system")
flag.StringVar(&flags.timeout, "timeout", "60s", "Timeout to wait for all datasource metadata") flag.StringVar(&flags.timeout, "timeout", "60s", "Timeout to wait for all datasource metadata")
flag.StringVar(&flags.dstimeout, "dstimeout", "10s", "Timeout to wait for single datasource metadata") flag.StringVar(&flags.dstimeout, "dstimeout", "10s", "Timeout to wait for single datasource metadata")
} }
type oemConfig map[string]string type oemConfig map[string]string
@ -112,10 +111,6 @@ var (
"from-ec2-metadata": "http://169.254.169.254/", "from-ec2-metadata": "http://169.254.169.254/",
"from-configdrive": "/media/configdrive", "from-configdrive": "/media/configdrive",
}, },
"openstack": oemConfig{
"from-openstack-metadata": "http://169.254.169.254/",
"convert-netconf": "debian",
},
"rackspace-onmetal": oemConfig{ "rackspace-onmetal": oemConfig{
"from-configdrive": "/media/configdrive", "from-configdrive": "/media/configdrive",
"convert-netconf": "debian", "convert-netconf": "debian",
@ -123,16 +118,16 @@ var (
"azure": oemConfig{ "azure": oemConfig{
"from-waagent": "/var/lib/waagent", "from-waagent": "/var/lib/waagent",
}, },
"cloudsigma": oemConfig{ // "cloudsigma": oemConfig{
"from-cloudsigma-metadata": "true", // "from-cloudsigma-metadata": "true",
}, // },
"packet": oemConfig{ "packet": oemConfig{
"from-packet-metadata": "https://metadata.packet.net/", "from-packet-metadata": "https://metadata.packet.net/",
}, },
"vmware": oemConfig{ // "vmware": oemConfig{
"from-vmware-guestinfo": "true", // "from-vmware-guestinfo": "true",
"convert-netconf": "vmware", // "convert-netconf": "vmware",
}, // },
} }
) )
@ -182,7 +177,7 @@ func main() {
case "debian": case "debian":
case "digitalocean": case "digitalocean":
case "packet": case "packet":
case "vmware": // case "vmware":
default: default:
fmt.Printf("Invalid option to -convert-netconf: '%s'. Supported options: 'debian, digitalocean, packet, vmware'\n", flags.convertNetconf) fmt.Printf("Invalid option to -convert-netconf: '%s'. Supported options: 'debian, digitalocean, packet, vmware'\n", flags.convertNetconf)
os.Exit(2) os.Exit(2)
@ -190,7 +185,7 @@ 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-openstack-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-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)
} }
@ -265,8 +260,8 @@ func main() {
ifaces, err = network.ProcessDigitalOceanNetconf(metadata.NetworkConfig.(digitalocean.Metadata)) ifaces, err = network.ProcessDigitalOceanNetconf(metadata.NetworkConfig.(digitalocean.Metadata))
case "packet": case "packet":
ifaces, err = network.ProcessPacketNetconf(metadata.NetworkConfig.(packet.NetworkData)) ifaces, err = network.ProcessPacketNetconf(metadata.NetworkConfig.(packet.NetworkData))
case "vmware": // case "vmware":
ifaces, err = network.ProcessVMwareNetconf(metadata.NetworkConfig.(map[string]string)) // ifaces, err = network.ProcessVMwareNetconf(metadata.NetworkConfig.(map[string]string))
default: default:
err = fmt.Errorf("Unsupported network config format %q", flags.convertNetconf) err = fmt.Errorf("Unsupported network config format %q", flags.convertNetconf)
} }
@ -339,9 +334,6 @@ func getDatasources() []datasource.Datasource {
if flags.sources.digitalOceanMetadataService != "" { if flags.sources.digitalOceanMetadataService != "" {
dss = append(dss, digitalocean.NewDatasource(flags.sources.digitalOceanMetadataService)) dss = append(dss, digitalocean.NewDatasource(flags.sources.digitalOceanMetadataService))
} }
if flags.sources.openstackMetadataService != "" {
dss = append(dss, openstack.NewDatasource(flags.sources.openstackMetadataService))
}
if flags.sources.waagent != "" { if flags.sources.waagent != "" {
dss = append(dss, waagent.NewDatasource(flags.sources.waagent)) dss = append(dss, waagent.NewDatasource(flags.sources.waagent))
} }
@ -351,9 +343,9 @@ func getDatasources() []datasource.Datasource {
if flags.sources.procCmdLine { if flags.sources.procCmdLine {
dss = append(dss, proc_cmdline.NewDatasource()) dss = append(dss, proc_cmdline.NewDatasource())
} }
if flags.sources.vmware { // if flags.sources.vmware {
dss = append(dss, vmware.NewDatasource()) // dss = append(dss, vmware.NewDatasource())
} // }
return dss return dss
} }

View File

@ -23,8 +23,8 @@ import (
"github.com/coreos/coreos-cloudinit/datasource" "github.com/coreos/coreos-cloudinit/datasource"
"github.com/coreos/coreos-cloudinit/pkg" "github.com/coreos/coreos-cloudinit/pkg"
"github.com/coreos/coreos-cloudinit/Godeps/_workspace/src/github.com/sigma/vmw-guestinfo/rpcvmx" "github.com/sigma/vmw-guestinfo/rpcvmx"
"github.com/coreos/coreos-cloudinit/Godeps/_workspace/src/github.com/sigma/vmw-guestinfo/vmcheck" "github.com/sigma/vmw-guestinfo/vmcheck"
) )
type readConfigFunction func(key string) (string, error) type readConfigFunction func(key string) (string, error)

View File

@ -20,9 +20,9 @@ import (
"os/exec" "os/exec"
"strings" "strings"
"github.com/vishvananda/netlink"
"github.com/coreos/coreos-cloudinit/config" "github.com/coreos/coreos-cloudinit/config"
"github.com/coreos/coreos-cloudinit/network" "github.com/coreos/coreos-cloudinit/network"
"github.com/vishvananda/netlink"
) )
func RestartNetwork(interfaces []network.InterfaceGenerator) (err error) { func RestartNetwork(interfaces []network.InterfaceGenerator) (err error) {
@ -56,7 +56,11 @@ func downNetworkInterfaces(interfaces []network.InterfaceGenerator) error {
for _, iface := range interfaces { for _, iface := range interfaces {
if systemInterface, ok := sysInterfaceMap[iface.Name()]; ok { if systemInterface, ok := sysInterfaceMap[iface.Name()]; ok {
log.Printf("Taking down interface %q\n", systemInterface.Name) log.Printf("Taking down interface %q\n", systemInterface.Name)
if err := netlink.NetworkLinkDown(systemInterface); err != nil { link, err := netlink.LinkByName(systemInterface.Name)
if err != nil {
log.Printf("Error while downing interface %q (%s). Continuing...\n", systemInterface.Name, err)
}
if err = netlink.LinkSetDown(link); err != nil {
log.Printf("Error while downing interface %q (%s). Continuing...\n", systemInterface.Name, err) log.Printf("Error while downing interface %q (%s). Continuing...\n", systemInterface.Name, err)
} }
} }

View File

@ -3,8 +3,8 @@ package main
import ( import (
"fmt" "fmt"
"github.com/coreos/coreos-cloudinit/Godeps/_workspace/src/github.com/sigma/vmw-guestinfo/rpcvmx" "github.com/coreos/coreos-cloudinit/github.com/sigma/vmw-guestinfo/rpcvmx"
"github.com/coreos/coreos-cloudinit/Godeps/_workspace/src/github.com/sigma/vmw-guestinfo/vmcheck" "github.com/coreos/coreos-cloudinit/github.com/sigma/vmw-guestinfo/vmcheck"
) )
func main() { func main() {

View File

@ -3,7 +3,7 @@ package message
import ( import (
"errors" "errors"
"github.com/coreos/coreos-cloudinit/Godeps/_workspace/src/github.com/sigma/vmw-guestinfo/bridge" "github.com/sigma/vmw-guestinfo/bridge"
) )
var ( var (

View File

@ -4,7 +4,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"github.com/coreos/coreos-cloudinit/Godeps/_workspace/src/github.com/sigma/vmw-guestinfo/message" "github.com/sigma/vmw-guestinfo/message"
) )
// ErrRpciFormat represents an invalid result format // ErrRpciFormat represents an invalid result format

View File

@ -5,7 +5,7 @@ import (
"strconv" "strconv"
"strings" "strings"
"github.com/coreos/coreos-cloudinit/Godeps/_workspace/src/github.com/sigma/vmw-guestinfo/rpcout" "github.com/sigma/vmw-guestinfo/rpcout"
) )
// Config gives access to the vmx config through the VMware backdoor // Config gives access to the vmx config through the VMware backdoor

View File

@ -1,7 +1,7 @@
package vmcheck package vmcheck
import ( import (
"github.com/coreos/coreos-cloudinit/Godeps/_workspace/src/github.com/sigma/vmw-guestinfo/bridge" "github.com/sigma/vmw-guestinfo/bridge"
) )
// IsVirtualWorld returns whether the code is running in a VMware virtual machine or no // IsVirtualWorld returns whether the code is running in a VMware virtual machine or no