本文整理汇总了Golang中github.com/docker/machine/libmachine/log.Debug函数的典型用法代码示例。如果您正苦于以下问题:Golang Debug函数的具体用法?Golang Debug怎么用?Golang Debug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Debug函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: execServer
func (lbp *LocalBinaryPlugin) execServer() error {
outScanner, errScanner, err := lbp.Executor.Start()
if err != nil {
return err
}
// Scan just one line to get the address, then send it to the relevant
// channel.
outScanner.Scan()
addr := outScanner.Text()
if err := outScanner.Err(); err != nil {
return fmt.Errorf("Reading plugin address failed: %s", err)
}
lbp.addrCh <- strings.TrimSpace(addr)
stdOutCh, stopStdoutCh := lbp.AttachStream(outScanner)
stdErrCh, stopStderrCh := lbp.AttachStream(errScanner)
for {
select {
case out := <-stdOutCh:
log.Debug(fmt.Sprintf(pluginOutPrefix, lbp.MachineName), out)
case err := <-stdErrCh:
log.Debug(fmt.Sprintf(pluginErrPrefix, lbp.MachineName), err)
case _ = <-lbp.stopCh:
stopStdoutCh <- true
stopStderrCh <- true
if err := lbp.Executor.Close(); err != nil {
return fmt.Errorf("Error closing local plugin binary: %s", err)
}
return nil
}
}
}
开发者ID:nlamirault,项目名称:docker-machine-scaleway,代码行数:35,代码来源:plugin.go
示例2: findStorageAccount
func (a AzureClient) findStorageAccount(resourceGroup, location, prefix string, storageType storage.AccountType) (*storage.AccountProperties, error) {
f := logutil.Fields{
"type": storageType,
"prefix": prefix,
"location": location}
log.Debug("Querying existing storage accounts.", f)
l, err := a.storageAccountsClient().ListByResourceGroup(resourceGroup)
if err != nil {
return nil, err
}
if l.Value != nil {
for _, v := range *l.Value {
log.Debug("Iterating...", logutil.Fields{
"name": to.String(v.Name),
"type": storageType,
"location": to.String(v.Location),
})
if to.String(v.Location) == location && v.Properties.AccountType == storageType && strings.HasPrefix(to.String(v.Name), prefix) {
log.Debug("Found eligible storage account.", logutil.Fields{"name": to.String(v.Name)})
return v.Properties, nil
}
}
}
log.Debug("No account matching the pattern is found.", f)
return nil, err
}
开发者ID:RaulKite,项目名称:machine,代码行数:27,代码来源:azureutil.go
示例3: enableBasicAuthForWinRM
func (provisioner *WindowsProvisioner) enableBasicAuthForWinRM() bool {
log.Debug("Enabling basic auth for WinRM")
ip, err := provisioner.Driver.GetIP()
if err != nil {
return false
}
d := provisioner.Driver
stdout, stderr, exit, err := drivers.WinRMRunCmdWithNTLM(ip,
d.GetSSHUsername(),
d.GetSSHPassword(),
enableBasicAuthCmd)
if (err != nil) || (exit != 0) {
log.Warn("Error getting WinRM command to enable basic auth:", err)
log.Debug("Enable basic auth output:", stdout, ", err:", stderr, ", exit:", exit)
return false
}
stdout, stderr, exit, err = drivers.WinRMRunCmdWithNTLM(ip,
d.GetSSHUsername(),
d.GetSSHPassword(),
enableUnencryptedCmd)
if (err != nil) || (exit != 0) {
log.Warn("Error getting WinRM command to enable unencrypted comm:", err)
log.Debug("Enable unencrypted comm output:", stdout, ", err:", stderr, ", exit:", exit)
return false
}
// The daemon is up if the command worked. Carry on.
log.Debug("Successfully enabled basic auth for WinRM")
return true
}
开发者ID:containerx,项目名称:machine,代码行数:33,代码来源:windows.go
示例4: TestSaveServer
// TestSaveServer implement save server
func TestSaveServer(t *testing.T) {
var (
d *ICSPTest
c *icsp.ICSPClient
)
if os.Getenv("ICSP_TEST_ACCEPTANCE") == "true" {
log.Debug("implements acceptance test for TestCreateServer")
d, c = getTestDriverA()
if c == nil {
t.Fatalf("Failed to execute getTestDriver() ")
}
// get a Server
serialNumber := d.Tc.GetTestData(d.Env, "FreeBladeSerialNumber").(string)
s, err := c.GetServerBySerialNumber(serialNumber)
assert.NoError(t, err, "GetServerBySerialNumber threw error -> %s, %+v\n", err, s)
// set a custom attribute
s.SetCustomAttribute("docker_user", "server", "docker")
// use test keys like from https://github.com/mitchellh/vagrant/tree/master/keys
// private key from https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant
s.SetCustomAttribute("public_key", "server", "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ==")
// save a server
news, err := c.SaveServer(s)
assert.NoError(t, err, "SaveServer threw error -> %s, %+v\n", err, news)
assert.Equal(t, s.UUID, news.UUID, "Should return a server with the same UUID")
// verify that the server attribute was saved by getting the server again and checking the value
_, testValue2 := s.GetValueItem("docker_user", "server")
assert.Equal(t, "docker", testValue2.Value, "Should return the saved custom attribute")
} else {
log.Debug("implements unit test for TestCreateServer")
var s icsp.Server
_, c = getTestDriverU()
s, err := c.SaveServer(s)
assert.Error(t, err, "SaveServer threw error -> %s, %+v\n", err, s)
}
}
开发者ID:HewlettPackard,项目名称:oneview-golang,代码行数:36,代码来源:servers_test.go
示例5: TestGetPublicIPV4
// func (s Server) GetPublicIPV4() (string, error) {
// TestGetPublicIPV4 try to test for getting interface from custom attribute
func TestGetPublicIPV4(t *testing.T) {
var (
d *ICSPTest
c *icsp.ICSPClient
serialNumber string
)
if os.Getenv("ICSP_TEST_ACCEPTANCE") == "true" {
log.Debug("implements acceptance test for TestGetPublicIPV4")
d, c = getTestDriverA()
if c == nil {
t.Fatalf("Failed to execute getTestDriver() ")
}
if os.Getenv("ONEVIEW_TEST_PROVISION") == "true" {
serialNumber = d.Tc.GetTestData(d.Env, "FreeICSPSerialNumber").(string)
} else {
serialNumber = d.Tc.GetTestData(d.Env, "SerialNumber").(string)
}
s, err := c.GetServerBySerialNumber(serialNumber)
testIP, err := s.GetPublicIPV4()
assert.NoError(t, err, "Should GetPublicIPV4 without error -> %s, %+v\n", err, s)
log.Debugf(" testIP -> %s", testIP)
assert.True(t, (len(testIP) > 0), "Should return an ip address string")
} else {
// TODO: implement a test
// need to simplate createing public_interface custom attribute object
// need to read custom attribute object, see server_customattribute_test.go
log.Debug("implements unit test for TestGetPublicIPV4")
}
}
开发者ID:HewlettPackard,项目名称:oneview-golang,代码行数:31,代码来源:servers_test.go
示例6: stackAvailable
func (d *Driver) stackAvailable() (bool, error) {
log.Debug("Checking if the stack is available......")
svc := cloudformation.New(session.New())
params := &cloudformation.DescribeStacksInput{
StackName: aws.String(d.MachineName),
}
resp, err := svc.DescribeStacks(params)
log.Debug(resp)
if err != nil {
return false, err
}
if *resp.Stacks[0].StackStatus == cloudformation.StackStatusRollbackInProgress || *resp.Stacks[0].StackStatus == cloudformation.StackStatusRollbackComplete {
return false, errors.New("Stack Rollback Occured")
}
if *resp.Stacks[0].StackStatus == cloudformation.StackStatusCreateComplete {
return true, nil
} else {
log.Debug("Stack Not Available Yet")
return false, nil
}
}
开发者ID:waterytowers,项目名称:machine-cloudformation,代码行数:28,代码来源:amazoncf.go
示例7: GetState
func (d *Driver) GetState() (state.State, error) {
log.Debug("Get status for OpenStack instance...", map[string]string{"MachineId": d.MachineId})
if err := d.initCompute(); err != nil {
return state.None, err
}
s, err := d.client.GetInstanceState(d)
if err != nil {
return state.None, err
}
log.Debug("State for OpenStack instance", map[string]string{
"MachineId": d.MachineId,
"State": s,
})
switch s {
case "ACTIVE":
return state.Running, nil
case "PAUSED":
return state.Paused, nil
case "SUSPENDED":
return state.Saved, nil
case "SHUTOFF":
return state.Stopped, nil
case "BUILDING":
return state.Starting, nil
case "ERROR":
return state.Error, nil
}
return state.None, nil
}
开发者ID:robvanmieghem,项目名称:machine,代码行数:32,代码来源:openstack.go
示例8: Create
func (d *Driver) Create() error {
if err := d.setUserSubscription(); err != nil {
return err
}
log.Info("Creating Azure machine...")
vmConfig, err := vmClient.CreateAzureVMConfiguration(d.MachineName, d.Size, d.Image, d.Location)
if err != nil {
return err
}
log.Debug("Generating certificate for Azure...")
if err := d.generateCertForAzure(); err != nil {
return err
}
log.Debug("Adding Linux provisioning...")
vmConfig, err = vmClient.AddAzureLinuxProvisioningConfig(vmConfig, d.GetSSHUsername(), d.UserPassword, d.azureCertPath(), d.SSHPort)
if err != nil {
return err
}
log.Debug("Authorizing ports...")
if err := d.addDockerEndpoints(vmConfig); err != nil {
return err
}
log.Debug("Creating VM...")
if err := vmClient.CreateAzureVM(vmConfig, d.MachineName, d.Location); err != nil {
return err
}
return nil
}
开发者ID:usmanismail,项目名称:machine,代码行数:34,代码来源:azure.go
示例9: MakeDiskImage
// MakeDiskImage makes a boot2docker VM disk image.
// See https://github.com/boot2docker/boot2docker/blob/master/rootfs/rootfs/etc/rc.d/automount
func MakeDiskImage(publicSSHKeyPath string) (*bytes.Buffer, error) {
magicString := "boot2docker, please format-me"
buf := new(bytes.Buffer)
tw := tar.NewWriter(buf)
// magicString first so the automount script knows to format the disk
file := &tar.Header{Name: magicString, Size: int64(len(magicString))}
log.Debug("Writing magic tar header")
if err := tw.WriteHeader(file); err != nil {
return nil, err
}
if _, err := tw.Write([]byte(magicString)); err != nil {
return nil, err
}
// .ssh/key.pub => authorized_keys
file = &tar.Header{Name: ".ssh", Typeflag: tar.TypeDir, Mode: 0700}
if err := tw.WriteHeader(file); err != nil {
return nil, err
}
log.Debug("Writing SSH key tar header")
pubKey, err := ioutil.ReadFile(publicSSHKeyPath)
if err != nil {
return nil, err
}
file = &tar.Header{Name: ".ssh/authorized_keys", Size: int64(len(pubKey)), Mode: 0644}
if err := tw.WriteHeader(file); err != nil {
return nil, err
}
if _, err := tw.Write([]byte(pubKey)); err != nil {
return nil, err
}
file = &tar.Header{Name: ".ssh/authorized_keys2", Size: int64(len(pubKey)), Mode: 0644}
if err := tw.WriteHeader(file); err != nil {
return nil, err
}
if _, err := tw.Write([]byte(pubKey)); err != nil {
return nil, err
}
if err := tw.Close(); err != nil {
return nil, err
}
return buf, nil
}
开发者ID:RaulKite,项目名称:machine,代码行数:58,代码来源:b2d.go
示例10: TestApplyDeploymentJobs
// integrated acceptance test
// TestSaveServer implement save server
//TODO: a workaround to figuring out how to bubble up public ip address information from the os to icsp after os build plan provisioning
// @[email protected] "@[email protected]" @[email protected] "@[email protected]" "@[email protected]" "@[email protected]"
func TestApplyDeploymentJobs(t *testing.T) {
var (
d *ICSPTest
c *ICSPClient
serialNumber string
)
if os.Getenv("ICSP_TEST_ACCEPTANCE") == "true" {
log.Debug("implements acceptance test for ApplyDeploymentJobs")
d, c = getTestDriverA()
if c == nil {
t.Fatalf("Failed to execute getTestDriver() ")
}
// get a Server
osBuildPlans := make([]string, 1)
osBuildPlans[0] = d.Tc.GetTestData(d.Env, "OSBuildPlan").(string)
if os.Getenv("ONEVIEW_TEST_PROVISION") != "true" {
serialNumber = d.Tc.GetTestData(d.Env, "SerialNumber").(string)
} else {
serialNumber = d.Tc.GetTestData(d.Env, "FreeICSPSerialNumber").(string)
}
s, err := c.GetServerBySerialNumber(serialNumber)
assert.NoError(t, err, "GetServerBySerialNumber threw error -> %s, %+v\n", err, s)
// set a custom attribute
s.SetCustomAttribute("docker_user", "server", "docker")
s.SetCustomAttribute("docker_hostname", "server", d.Tc.GetTestData(d.Env, "HostName").(string))
// use test keys like from https://github.com/mitchellh/vagrant/tree/master/keys
// private key from https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant
s.SetCustomAttribute("public_key", "server", "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ==")
// save a server
news, err := c.SaveServer(s)
assert.NoError(t, err, "SaveServer threw error -> %s, %+v\n", err, news)
assert.Equal(t, s.UUID, news.UUID, "Should return a server with the same UUID")
// verify that the server attribute was saved by getting the server again and checking the value
_, testValue2 := s.GetValueItem("docker_user", "server")
assert.Equal(t, "docker", testValue2.Value, "Should return the saved custom attribute")
if os.Getenv("ONEVIEW_TEST_PROVISION") != "true" {
log.Info("env ONEVIEW_TEST_PROVISION != ture for ApplyDeploymentJobs")
log.Infof("Skipping OS build for : %s, %s", osBuildPlans, serialNumber)
return
}
_, err = c.ApplyDeploymentJobs(osBuildPlans, nil, s)
assert.NoError(t, err, "ApplyDeploymentJobs threw error -> %s, %+v\n", err, news)
} else {
var s Server
_, c = getTestDriverU()
log.Debug("implements unit test for ApplyDeploymentJobs")
testPlans := make([]string, 1)
testPlans[0] = "testbuildplan"
_, err := c.ApplyDeploymentJobs(testPlans, nil, s)
assert.Error(t, err, "ApplyDeploymentJobs threw error -> %s, %+v\n", err, s)
}
}
开发者ID:wenlock,项目名称:oneview-golang,代码行数:59,代码来源:icsp_test.go
示例11: instanceIsRunning
func (d *Driver) instanceIsRunning() bool {
st, err := d.GetState()
if err != nil {
log.Debug(err)
}
if st == state.Running {
return true
}
log.Debug("VPS not yet started")
return false
}
开发者ID:mtrofimm,项目名称:docker-machine-vultr,代码行数:11,代码来源:vultr.go
示例12: Close
func (c *RpcClientDriver) Close() error {
log.Debug("Making call to close driver server")
if err := c.Client.Call("RpcServerDriver.Close", struct{}{}, nil); err != nil {
return err
}
log.Debug("Successfully made call to close driver server")
return nil
}
开发者ID:nlamirault,项目名称:docker-machine-scaleway,代码行数:11,代码来源:client_driver.go
示例13: generateDiskImage
// Make a boot2docker VM disk image.
func (d *Driver) generateDiskImage(size int) error {
log.Debugf("Creating %d MB hard disk image...", size)
magicString := "boot2docker, please format-me"
buf := new(bytes.Buffer)
tw := tar.NewWriter(buf)
// magicString first so the automount script knows to format the disk
file := &tar.Header{Name: magicString, Size: int64(len(magicString))}
log.Debug("Writing magic tar header")
if err := tw.WriteHeader(file); err != nil {
return err
}
if _, err := tw.Write([]byte(magicString)); err != nil {
return err
}
// .ssh/key.pub => authorized_keys
file = &tar.Header{Name: ".ssh", Typeflag: tar.TypeDir, Mode: 0700}
if err := tw.WriteHeader(file); err != nil {
return err
}
log.Debug("Writing SSH key tar header")
pubKey, err := ioutil.ReadFile(d.publicSSHKeyPath())
if err != nil {
return err
}
file = &tar.Header{Name: ".ssh/authorized_keys", Size: int64(len(pubKey)), Mode: 0644}
if err := tw.WriteHeader(file); err != nil {
return err
}
if _, err := tw.Write([]byte(pubKey)); err != nil {
return err
}
file = &tar.Header{Name: ".ssh/authorized_keys2", Size: int64(len(pubKey)), Mode: 0644}
if err := tw.WriteHeader(file); err != nil {
return err
}
if _, err := tw.Write([]byte(pubKey)); err != nil {
return err
}
if err := tw.Close(); err != nil {
return err
}
raw := bytes.NewReader(buf.Bytes())
log.Debug("Calling inner createDiskImage")
return createDiskImage(d.diskPath(), size, raw)
}
开发者ID:cvstebut,项目名称:machine,代码行数:55,代码来源:virtualbox.go
示例14: getIPfromDHCPLease
func (d *Driver) getIPfromDHCPLease() (string, error) {
var dhcpfh *os.File
var dhcpcontent []byte
// var macaddr string
var err error
var lastipmatch string
var currentip string
// DHCP lease table for NAT vmnet interface
var dhcpfile = "/var/db/dhcpd_leases"
if dhcpfh, err = os.Open(dhcpfile); err != nil {
return "", err
}
defer dhcpfh.Close()
if dhcpcontent, err = ioutil.ReadAll(dhcpfh); err != nil {
return "", err
}
// Get the IP from the lease table.
leaseip := regexp.MustCompile(`^\s*ip_address=(.+?)$`)
log.Debug(leaseip) // TODO
// Get the MAC address associated.
// leasemac := regexp.MustCompile(`^\s*hw_address=1,(.+?)$`)
// log.Debug(leasemac) // TODO
for _, line := range strings.Split(string(dhcpcontent), "\n") {
// if matches := leasemac.FindStringSubmatch(line); matches != nil {
// currentip = lastipmatch
// // macaddr = matches[1]
// log.Debug(macaddr)
// break
// }
if matches := leaseip.FindStringSubmatch(line); matches != nil {
lastipmatch = matches[1]
log.Debug(lastipmatch)
break
}
}
//
// if currentip == "" {
// return "", fmt.Errorf("IP not found for MAC %s in DHCP leases", leaseip)
// }
//
// if macaddr == "" {
// return "", fmt.Errorf("couldn't find MAC address in DHCP leases file %s", dhcpfile)
// }
log.Debugf("IP found in DHCP lease table: %s", currentip)
return currentip, nil
}
开发者ID:zchee,项目名称:docker-machine-hypercore,代码行数:54,代码来源:hypercore.go
示例15: TestGetInterfaces
// TestGetInterfaces verify that interfaces works
func TestGetInterfaces(t *testing.T) {
var (
d *ICSPTest
c *icsp.ICSPClient
s icsp.Server
serialNumber string
err error
)
if os.Getenv("ICSP_TEST_ACCEPTANCE") == "true" {
log.Debug("implements acceptance test for TestGetInterfaces")
d, c = getTestDriverA()
if c == nil {
t.Fatalf("Failed to execute getTestDriver() ")
}
if os.Getenv("ONEVIEW_TEST_PROVISION") == "true" {
serialNumber = d.Tc.GetTestData(d.Env, "FreeBladeSerialNumber").(string)
s, err = c.GetServerBySerialNumber(serialNumber)
} else {
serialNumber = d.Tc.GetTestData(d.Env, "SerialNumber").(string)
s, err = c.GetServerBySerialNumber(serialNumber)
}
data := s.GetInterfaces()
assert.NoError(t, err, "GetInterfaces threw error -> %s, %+v\n", err, data)
assert.True(t, len(data) > 0, "Failed to get a valid list of interfaces -> %+v", data)
for _, inet := range data {
log.Infof("inet -> %+v", inet)
log.Infof("inet ip -> %+v", inet.IPV4Addr)
log.Infof("inet ip -> %+v", inet.Slot)
log.Infof("inet ip -> %+v", inet.MACAddr)
}
} else {
log.Debug("implements unit test for TestGetInterfaces")
d, c = getTestDriverU()
jsonServerData := d.Tc.GetTestData(d.Env, "ServerJSONString").(string)
log.Debugf("jsonServerData => %s", jsonServerData)
err := json.Unmarshal([]byte(jsonServerData), &s)
assert.NoError(t, err, "Unmarshal Server threw error -> %s, %+v\n", err, jsonServerData)
log.Debugf("server -> %v", s)
data := s.GetInterfaces()
log.Debugf("Interfaces -> %+v", data)
assert.True(t, len(data) > 0, "Failed to get a valid list of interfaces -> %+v", data)
for _, inet := range data {
log.Debugf("inet -> %+v", inet)
log.Debugf("inet ip -> %+v", inet.IPV4Addr)
log.Debugf("inet ip -> %+v", inet.Slot)
log.Debugf("inet ip -> %+v", inet.MACAddr)
}
}
}
开发者ID:HewlettPackard,项目名称:oneview-golang,代码行数:53,代码来源:servers_test.go
示例16: waitVMPowerState
// waitVMPowerState polls the Virtual Machine instance view until it reaches the
// specified goal power state or times out. If checking for virtual machine
// state fails or waiting times out, an error is returned.
func (a AzureClient) waitVMPowerState(resourceGroup, name string, goalState VMPowerState, timeout time.Duration) error {
// NOTE(ahmetalpbalkan): Azure APIs for Start and Stop are actually async
// operations on which our SDK blocks and does polling until the operation
// is complete.
//
// By the time the issued power cycle operation is complete, the VM will be
// already in the goal PowerState. Hence, this method will return in the
// first check, however there is no harm in being defensive.
log.Debug("Waiting until VM reaches goal power state.", logutil.Fields{
"vm": name,
"goalState": goalState,
"timeout": timeout,
})
chErr := make(chan error)
go func(ch chan error) {
for {
select {
case <-ch:
// channel closed
return
default:
state, err := a.GetVirtualMachinePowerState(resourceGroup, name)
if err != nil {
ch <- err
return
}
if state != goalState {
log.Debug(fmt.Sprintf("Waiting %v...", powerStatePollingInterval),
logutil.Fields{
"goalState": goalState,
"state": state,
})
time.Sleep(powerStatePollingInterval)
} else {
log.Debug("Reached goal power state.",
logutil.Fields{"state": state})
ch <- nil
return
}
}
}
}(chErr)
select {
case <-time.After(timeout):
close(chErr)
return fmt.Errorf("Waiting for goal state %q timed out after %v", goalState, timeout)
case err := <-chErr:
return err
}
}
开发者ID:RaulKite,项目名称:machine,代码行数:55,代码来源:azureutil.go
示例17: addFile
func addFile(path string, metaData *bugsnag.MetaData) {
file, err := os.Open(path)
if err != nil {
log.Debug(err)
return
}
data, err := ioutil.ReadAll(file)
if err != nil {
log.Debug(err)
return
}
metaData.Add("logfile", filepath.Base(path), string(data))
}
开发者ID:RaulKite,项目名称:machine,代码行数:13,代码来源:crash_report.go
示例18: hostOnlyIpAvailable
func (d *Driver) hostOnlyIpAvailable() bool {
ip, err := d.GetIP()
if err != nil {
log.Debug("ERROR getting IP: %s", err)
return false
}
if ip != "" {
log.Debugf("IP is %s", ip)
return true
}
log.Debug("Strangely, there was no error attempting to get the IP, but it was still empty.")
return false
}
开发者ID:hanazuki,项目名称:machine,代码行数:13,代码来源:virtualbox.go
示例19: GetPublicIPAddress
// GetPublicIPAddress attempts to get public IP address from the Public IP
// resource. If IP address is not allocated yet, returns empty string.
func (a AzureClient) GetPublicIPAddress(resourceGroup, name string) (string, error) {
f := logutil.Fields{"name": name}
log.Debug("Querying public IP address.", f)
ip, err := a.publicIPAddressClient().Get(resourceGroup, name, "")
if err != nil {
return "", err
}
if ip.Properties == nil {
log.Debug("publicIP.Properties is nil. Could not determine IP address", f)
return "", nil
}
return to.String(ip.Properties.IPAddress), nil
}
开发者ID:RaulKite,项目名称:machine,代码行数:15,代码来源:azureutil.go
示例20: configureIPAddress
func (d *Driver) configureIPAddress() error {
// create an EIP and bind it to host
if !d.PrivateIPOnly {
createEIPParams := unet.AllocateEIPParams{
Region: d.Region,
OperatorName: "Bgp",
Bandwidth: 2,
ChargeType: "Dynamic",
Quantity: 1,
}
resp, err := d.getUNetService().AllocateEIP(&createEIPParams)
if err != nil {
return fmt.Errorf("Allocate EIP failed:%s", err)
}
log.Debug(resp)
if len(*resp.EIPSet) == 0 {
return fmt.Errorf("EIP is empty")
}
eipId := (*resp.EIPSet)[0].EIPId
if len(*(*resp.EIPSet)[0].EIPAddr) == 0 {
return fmt.Errorf("IP Address is empty")
}
d.IPAddress = (*(*resp.EIPSet)[0].EIPAddr)[0].IP
bindHostParams := unet.BindEIPParams{
Region: d.Region,
EIPId: eipId,
ResourceType: "uhost",
ResourceId: d.UhostID,
}
bindEIPResp, err := d.getUNetService().BindEIP(&bindHostParams)
if err != nil {
return fmt.Errorf("Bind EIP failed:%s", err)
}
log.Debug(bindEIPResp)
} else {
hostDetails, err := d.getHostDescription()
if err != nil {
return fmt.Errorf("get host detail failed: %s", err)
}
d.IPAddress = hostDetails.publicIPAddress
d.PrivateIPAddress = hostDetails.privateIPAddress
}
return nil
}
开发者ID:ucloud,项目名称:docker-machine-ucloud,代码行数:50,代码来源:client.go
注:本文中的github.com/docker/machine/libmachine/log.Debug函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论