当前位置: 首页>>代码示例>>Golang>>正文


Golang log.Warn函数代码示例

本文整理汇总了Golang中github.com/docker/machine/libmachine/log.Warn函数的典型用法代码示例。如果您正苦于以下问题:Golang Warn函数的具体用法?Golang Warn怎么用?Golang Warn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Warn函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: 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

示例2: MigrateHostV2ToHostV3

func MigrateHostV2ToHostV3(hostV2 *HostV2, data []byte, storePath string) *Host {
	// Migrate to include RawDriver so that driver plugin will work
	// smoothly.
	rawHost := &RawHost{}
	if err := json.Unmarshal(data, &rawHost); err != nil {
		log.Warn("Could not unmarshal raw host for RawDriver information: %s", err)
	}

	m := make(map[string]interface{})

	// Must migrate to include store path in driver since it was not
	// previously stored in drivers directly
	if err := json.Unmarshal(*rawHost.Driver, &m); err != nil {
		log.Warn("Could not unmarshal raw host into map[string]interface{}: %s", err)
	}

	m["StorePath"] = storePath

	// Now back to []byte
	rawDriver, err := json.Marshal(m)
	if err != nil {
		log.Warn("Could not re-marshal raw driver: %s", err)
	}

	h := &Host{
		ConfigVersion: 2,
		DriverName:    hostV2.DriverName,
		Name:          hostV2.Name,
		HostOptions:   hostV2.HostOptions,
		RawDriver:     rawDriver,
	}

	return h
}
开发者ID:nlamirault,项目名称:docker-machine-scaleway,代码行数:34,代码来源:migrate_v2_v3.go

示例3: Wait

// Wait - wait on job task to complete
func (jt *JobTask) Wait() error {
	var (
		currenttime int
	)
	log.Debugf("task : %+v", jt)
	if err := jt.GetCurrentStatus(); err != nil {
		jt.IsDone = true
		return err
	}

	for JOB_RUNNING_YES.Equal(jt.Running) && (currenttime < jt.Timeout) {
		log.Debugf("jt => %+v", jt)
		if jt.JobURI.URI.String() != "" {
			log.Debugf("Waiting for job to complete, %s ", jt.Description)
			lastjobstep := len(jt.JobProgress)
			if lastjobstep > 0 {
				statusmessage := jt.GetLastStatusUpdate()
				if statusmessage == "" {
					log.Infof("Waiting on, %s, %0.0f%%", jt.Description, jt.GetPercentProgress())
				} else {
					log.Infof("Waiting on, %s, %0.0f%%, %s", jt.Description, jt.GetPercentProgress(), statusmessage)
				}
			}
		} else {
			log.Info("Waiting on job creation.")
		}

		// wait time before next check
		time.Sleep(time.Millisecond * (1000 * jt.WaitTime)) // wait 10sec before checking the status again
		currenttime++

		// get the current status
		if err := jt.GetCurrentStatus(); err != nil {
			jt.IsDone = true
			return err
		}
	}
	if !(currenttime < jt.Timeout) {
		log.Warn("Task timed out.")
	}

	if JOB_RUNNING_NO.Equal(jt.Running) {
		log.Infof("Job, %s, completed", jt.GetComplettedStatus())
	} else {
		log.Warn("Job still running un-expected.")
	}
	jt.IsDone = true
	return nil
}
开发者ID:HewlettPackard,项目名称:oneview-golang,代码行数:50,代码来源:jobtask.go

示例4: isLatest

// isLatest checks the latest release tag and
// reports whether the local ISO cache is the latest version.
//
// It returns false if failing to get the local ISO version
// and true if failing to fetch the latest release tag.
func (b *B2dUtils) isLatest() bool {
	localVer, err := b.version()
	if err != nil {
		log.Warn("Unable to get the local Boot2Docker ISO version: ", err)
		return false
	}

	latestVer, err := b.getReleaseTag("")
	if err != nil {
		log.Warn("Unable to get the latest Boot2Docker ISO release version: ", err)
		return true
	}

	return localVer == latestVer
}
开发者ID:RaulKite,项目名称:machine,代码行数:20,代码来源:b2d.go

示例5: DeleteOSBuildPlan

func (c *I3SClient) DeleteOSBuildPlan(name string) error {
	var (
		osBuildPlan OSBuildPlan
		err         error
		uri         string
	)

	osBuildPlan, err = c.GetOSBuildPlanByName(name)
	if err != nil {
		return err
	}
	if osBuildPlan.Name != "" {
		log.Debugf("REST : %s \n %+v\n", osBuildPlan.URI, osBuildPlan)
		uri = osBuildPlan.URI.String()
		if uri == "" {
			log.Warn("Unable to post delete, no uri found.")
			return err
		}
		_, err := c.RestAPICall(rest.DELETE, uri, nil)
		if err != nil {
			log.Errorf("Error submitting delete os build plan request: %s", err)
			return err
		}

		return nil
	} else {
		log.Infof("OS Build Plan could not be found to delete, %s, skipping delete ...", name)
	}
	return nil
}
开发者ID:HewlettPackard,项目名称:oneview-golang,代码行数:30,代码来源:os_buildplan.go

示例6: getOrCreateHostOnlyNetwork

func getOrCreateHostOnlyNetwork(hostIP net.IP, netmask net.IPMask, nets map[string]*hostOnlyNetwork, vbox VBoxManager) (*hostOnlyNetwork, error) {
	// Search for an existing host-only adapter.
	hostOnlyAdapter := getHostOnlyAdapter(nets, hostIP, netmask)
	if hostOnlyAdapter != nil {
		return hostOnlyAdapter, nil
	}

	// No existing host-only adapter found. Create a new one.
	_, err := createHostonlyAdapter(vbox)
	if err != nil {
		// Sometimes the host-only adapter fails to create. See https://www.virtualbox.org/ticket/14040
		// BUT, it is created in fact! So let's wait until it appears last in the list
		log.Warnf("Creating a new host-only adapter produced an error: %s", err)
		log.Warn("This is a known VirtualBox bug. Let's try to recover anyway...")
	}

	// It can take some time for an adapter to appear. Let's poll.
	hostOnlyAdapter, err = waitForNewHostOnlyNetwork(nets, vbox)
	if err != nil {
		// Sometimes, Vbox says it created it but then it cannot be found...
		return nil, errNewHostOnlyAdapterNotVisible
	}

	log.Warnf("Found a new host-only adapter: %q", hostOnlyAdapter.Name)

	hostOnlyAdapter.IPv4.IP = hostIP
	hostOnlyAdapter.IPv4.Mask = netmask
	if err := hostOnlyAdapter.Save(vbox); err != nil {
		return nil, err
	}

	return hostOnlyAdapter, nil
}
开发者ID:tsuru,项目名称:tsuru,代码行数:33,代码来源:network.go

示例7: checkDockerVersion

func (provisioner *WindowsProvisioner) checkDockerVersion() bool {
	log.Debug("Checking docker version (secure)")

	ip, err := provisioner.Driver.GetIP()
	if err != nil {
		return false
	}

	dockerVersionSecureCmd := "docker -H tcp://127.0.0.1:2376 --tlsverify=false " +
		" --tlscacert=" + provisioner.AuthOptions.CaCertRemotePath +
		" --tlscert=" + provisioner.AuthOptions.ServerCertRemotePath +
		" --tlskey=" + provisioner.AuthOptions.ServerKeyRemotePath +
		" version"

	d := provisioner.Driver
	out, err, exit := drivers.WinRMRunCmd(
		ip,
		d.GetSSHUsername(),
		d.GetSSHPassword(),
		dockerVersionSecureCmd)
	if (err != nil) || (exit != 0) {
		log.Warn("Error getting WinRM command to get docker version (secure),",
			"out:", out, ", err:", err, ", exit:", exit)
		return false
	}

	if strings.Contains(out, expectedDockerBuiltDate) {
		return true
	}
	return false
}
开发者ID:containerx,项目名称:machine,代码行数:31,代码来源:windows.go

示例8: SubmitDeleteProfile

// submit new profile template
func (c *OVClient) SubmitDeleteProfile(p ServerProfile) (t *Task, err error) {
	var (
		uri = p.URI.String()
	// 	task = rest_api(:oneview, :post, '/rest/server-profiles', { 'body' => new_template_profile })
	)
	t = t.NewProfileTask(c)
	t.ResetTask()
	log.Debugf("REST : %s \n %+v\n", uri, p)
	log.Debugf("task -> %+v", t)
	if uri == "" {
		log.Warn("Unable to post delete, no uri found.")
		t.TaskIsDone = true
		return t, err
	}
	data, err := c.RestAPICall(rest.DELETE, uri, nil)
	if err != nil {
		log.Errorf("Error submitting new profile request: %s", err)
		t.TaskIsDone = true
		return t, err
	}

	log.Debugf("Response delete profile %s", data)
	if err := json.Unmarshal([]byte(data), &t); err != nil {
		t.TaskIsDone = true
		log.Errorf("Error with task un-marshal: %s", err)
		return t, err
	}

	return t, err
}
开发者ID:wenlock,项目名称:oneview-golang,代码行数:31,代码来源:profiles.go

示例9: DeletePlanScript

func (c *I3SClient) DeletePlanScript(name string) error {
	var (
		planScript PlanScript
		err        error
		uri        string
	)

	planScript, err = c.GetPlanScriptByName(name)
	if err != nil {
		return err
	}
	if planScript.Name != "" {
		log.Debugf("REST : %s \n %+v\n", planScript.URI, planScript)
		uri = planScript.URI.String()
		if uri == "" {
			log.Warn("Unable to post delete, no uri found.")
			return err
		}
		_, err := c.RestAPICall(rest.DELETE, uri, nil)
		if err != nil {
			log.Errorf("Error submitting delete plan script request: %s", err)
			return err
		}
	} else {
		log.Infof("Plan script could not be found to delete, %s, skipping delete ...", name)
	}
	return nil
}
开发者ID:HewlettPackard,项目名称:oneview-golang,代码行数:28,代码来源:plan_script.go

示例10: DumpVal

func DumpVal(vals ...interface{}) {
	for _, val := range vals {
		prettyJSON, err := json.MarshalIndent(val, "", "    ")
		if err != nil {
			log.Warn(err)
		}
		log.Debug(string(prettyJSON))
	}
}
开发者ID:jeffmaxton,项目名称:docker-machine-parallels,代码行数:9,代码来源:utils.go

示例11: dockerDaemonResponding

func (provisioner *RedHatProvisioner) dockerDaemonResponding() bool {
	if _, err := provisioner.SSHCommand("sudo docker version"); err != nil {
		log.Warn("Error getting SSH command to check if the daemon is up: %s", err)
		return false
	}

	// The daemon is up if the command worked.  Carry on.
	return true
}
开发者ID:nlamirault,项目名称:docker-machine-scaleway,代码行数:9,代码来源:redhat.go

示例12: generateId

func generateId() string {
	rb := make([]byte, 10)
	_, err := rand.Read(rb)
	if err != nil {
		log.Warn("Unable to generate id: %s", err)
	}

	h := md5.New()
	io.WriteString(h, string(rb))
	return fmt.Sprintf("%x", h.Sum(nil))
}
开发者ID:Red54,项目名称:machine,代码行数:11,代码来源:amazonec2.go

示例13: IsTestEnabled

// is test case enabled? defaults are always true
func (tc *TestConfig) IsTestEnabled(tc_name string) bool {
	if t := tc.GetTestCases(tc_name); t.Name == tc_name {
		return t.Enabled
	}
	if d := tc.GetTestCases("default"); d.Name != "" {
		return d.Enabled
	}
	log.Infof("tc no name -> %+v", tc.GetTestCases("foo"))
	log.Warn("Test config is using default true for enablement.")
	return true
}
开发者ID:HewlettPackard,项目名称:oneview-golang,代码行数:12,代码来源:testcases.go

示例14: Provision

func (provisioner *WindowsProvisioner) Provision(swarmOptions swarm.Options, authOptions auth.Options, engineOptions engine.Options) error {
	provisioner.AuthOptions = authOptions

	log.Debug("Waiting to enable basic auth for WinRM")
	if err := mcnutils.WaitForSpecific(provisioner.enableBasicAuthForWinRM, 60, 3*time.Second); err != nil {
		log.Warn("failed to enable basic auth: ", err)
		return err
	}

	log.Debug("Waiting for docker daemon")
	if err := mcnutils.WaitForSpecific(provisioner.dockerDaemonResponding, 60, 3*time.Second); err != nil {
		log.Warn("failed to get docker daemon status: ", err)
		return err
	}

	log.Debug("Updating docker on host")
	if err := mcnutils.WaitForSpecific(provisioner.updateDocker, 60, 3*time.Second); err != nil {
		log.Warn("failed to update docker daemon: ", err)
		return err
	}

	provisioner.AuthOptions = setRemoteAuthOptions(provisioner)
	if err := ConfigureAuth(provisioner); err != nil {
		return err
	}

	log.Debug("Opening docker port on host")
	if err := mcnutils.WaitForSpecific(provisioner.openDockerPortOnHost, 60, 3*time.Second); err != nil {
		log.Warn("failed to update docker daemon: ", err)
		return err
	}

	log.Debug("Checking that docker version is as expected")
	if err := mcnutils.WaitForSpecific(provisioner.checkDockerVersion, 60, 3*time.Second); err != nil {
		log.Warn("failed to check docker version: ", err)
		return err
	}

	return nil
}
开发者ID:containerx,项目名称:machine,代码行数:40,代码来源:windows.go

示例15: SaveIPv4

// SaveIPv4 changes the ipv4 configuration of the host-only network.
func (n *hostOnlyNetwork) SaveIPv4(vbox VBoxManager) error {
	if n.IPv4.IP != nil && n.IPv4.Mask != nil {
		if runtime.GOOS == "windows" {
			log.Warn("Windows might ask for the permission to configure a network adapter. Sometimes, such confirmation window is minimized in the taskbar.")
		}

		if err := vbox.vbm("hostonlyif", "ipconfig", n.Name, "--ip", n.IPv4.IP.String(), "--netmask", net.IP(n.IPv4.Mask).String()); err != nil {
			return err
		}
	}

	return nil
}
开发者ID:tsuru,项目名称:tsuru,代码行数:14,代码来源:network.go


注:本文中的github.com/docker/machine/libmachine/log.Warn函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。