本文整理汇总了Golang中github.com/docker/machine/log.Debug函数的典型用法代码示例。如果您正苦于以下问题:Golang Debug函数的具体用法?Golang Debug怎么用?Golang Debug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Debug函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: 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:robebeye,项目名称:machine,代码行数:34,代码来源:azure.go
示例2: TestIntegrationLogs
func TestIntegrationLogs(t *testing.T) {
logsLastH := getLogs(t, "LAST_HOUR")
logsLast24H := getLogs(t, "LAST_24H")
logsLast7D := getLogs(t, "LAST_7D")
logsLast30D := getLogs(t, "LAST_30D")
logsLast365D := getLogs(t, "LAST_365D")
for index, _ := range logsLastH {
assert.Equal(t, logsLastH[index].Id, logsLast24H[index].Id)
assert.Equal(t, logsLastH[index].Id, logsLast7D[index].Id)
assert.Equal(t, logsLastH[index].Id, logsLast30D[index].Id)
assert.Equal(t, logsLastH[index].Id, logsLast365D[index].Id)
}
for index, _ := range logsLast24H {
assert.Equal(t, logsLast24H[index].Id, logsLast7D[index].Id)
assert.Equal(t, logsLast24H[index].Id, logsLast30D[index].Id)
assert.Equal(t, logsLast24H[index].Id, logsLast365D[index].Id)
}
for index, _ := range logsLast7D {
assert.Equal(t, logsLast7D[index].Id, logsLast30D[index].Id)
assert.Equal(t, logsLast7D[index].Id, logsLast365D[index].Id)
}
for index, _ := range logsLast30D {
assert.Equal(t, logsLast30D[index].Id, logsLast365D[index].Id)
}
var i = 0
for index, _ := range logsLast7D {
i++
if i == 60 {
break
}
cLog, err := GetAPI().GetLog(logsLast7D[index].Id)
log.Debug(logsLast7D[index])
log.Debug(cLog)
assert.Nil(t, err)
assert.Equal(t, logsLast7D[index].Id, cLog.Id)
assert.Equal(t, logsLast7D[index].StartDate, cLog.StartDate)
assert.Equal(t, logsLast7D[index].EndDate, cLog.EndDate)
assert.Equal(t, logsLast7D[index].Duration, cLog.Duration)
assert.Equal(t, logsLast7D[index].Status.Percent, cLog.Status.Percent)
assert.Equal(t, logsLast7D[index].Status.State, cLog.Status.State)
assert.Equal(t, logsLast7D[index].Action, cLog.Action)
assert.Equal(t, logsLast7D[index].Type, cLog.Type)
assert.Equal(t, logsLast7D[index].Resource.Id, cLog.Resource.Id)
assert.Equal(t, logsLast7D[index].Resource.Name, cLog.Resource.Name)
assert.Equal(t, logsLast7D[index].User.Id, cLog.User.Id)
assert.Equal(t, logsLast7D[index].User.Name, cLog.User.Name)
assert.Equal(t, logsLast7D[index].CloudPanelId, cLog.CloudPanelId)
time.Sleep(1 * time.Second)
}
}
开发者ID:Noxaro,项目名称:oneandone-cloudserver-api-integrative-tests,代码行数:58,代码来源:logs_test.go
示例3: 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:Kast0rTr0y,项目名称:docker-machine,代码行数:13,代码来源:virtualbox.go
示例4: NewClient
func NewClient(user string, host string, port int, auth *Auth) (Client, error) {
sshBinaryPath, err := exec.LookPath("ssh")
if err != nil {
log.Debug("SSH binary not found, using native Go implementation")
return NewNativeClient(user, host, port, auth)
}
if defaultClientType == Native {
log.Debug("Using SSH client type: native")
return NewNativeClient(user, host, port, auth)
}
log.Debug("Using SSH client type: external")
return NewExternalClient(sshBinaryPath, user, host, port, auth)
}
开发者ID:jkingyens,项目名称:machine,代码行数:15,代码来源:client.go
示例5: awsApiCall
func (e *EC2) awsApiCall(v url.Values) (*http.Response, error) {
v.Set("Version", "2014-06-15")
log.Debug("Making AWS API call with values:")
utils.DumpVal(v)
client := &http.Client{}
finalEndpoint := fmt.Sprintf("%s?%s", e.Endpoint, v.Encode())
req, err := http.NewRequest("GET", finalEndpoint, nil)
if err != nil {
return &http.Response{}, fmt.Errorf("error creating request from client")
}
req.Header.Add("Content-type", "application/json")
awsauth.Sign4(req, awsauth.Credentials{
AccessKeyID: e.Auth.AccessKey,
SecretAccessKey: e.Auth.SecretKey,
SecurityToken: e.Auth.SessionToken,
})
resp, err := client.Do(req)
if err != nil {
fmt.Printf("client encountered error while doing the request: %s", err.Error())
return resp, fmt.Errorf("client encountered error while doing the request: %s", err)
}
if resp.StatusCode != http.StatusOK {
return resp, newAwsApiResponseError(*resp)
}
return resp, nil
}
开发者ID:sdgdsffdsfff,项目名称:dockerf,代码行数:28,代码来源:ec2.go
示例6: GetIP
func (d *Driver) GetIP() (string, error) {
// DHCP is used to get the IP, so virtualbox hosts don't have IPs unless
// they are running
s, err := d.GetState()
if err != nil {
return "", err
}
if s != state.Running {
return "", drivers.ErrHostIsNotRunning
}
sshClient, err := d.getLocalSSHClient()
if err != nil {
return "", err
}
output, err := sshClient.Output("ip addr show dev eth1")
if err != nil {
log.Debug(output)
return "", err
}
log.Debugf("SSH returned: %s\nEND SSH\n", output)
// parse to find: inet 192.168.59.103/24 brd 192.168.59.255 scope global eth1
lines := strings.Split(output, "\n")
for _, line := range lines {
vals := strings.Split(strings.TrimSpace(line), " ")
if len(vals) >= 2 && vals[0] == "inet" {
return vals[1][:strings.Index(vals[1], "/")], nil
}
}
return "", fmt.Errorf("No IP address found %s", output)
}
开发者ID:phusl,项目名称:machine,代码行数:35,代码来源:virtualbox.go
示例7: sshAvailableFunc
func sshAvailableFunc(d Driver) func() bool {
return func() bool {
log.Debug("Getting to WaitForSSH function...")
hostname, err := d.GetSSHHostname()
if err != nil {
log.Debugf("Error getting IP address waiting for SSH: %s", err)
return false
}
port, err := d.GetSSHPort()
if err != nil {
log.Debugf("Error getting SSH port: %s", err)
return false
}
if err := ssh.WaitForTCP(fmt.Sprintf("%s:%d", hostname, port)); err != nil {
log.Debugf("Error waiting for TCP waiting for SSH: %s", err)
return false
}
if _, err := RunSSHCommandFromDriver(d, "exit 0"); err != nil {
log.Debugf("Error getting ssh command 'exit 0' : %s", err)
return false
}
return true
}
}
开发者ID:cdosso,项目名称:machine,代码行数:25,代码来源:utils.go
示例8: Provision
func (provisioner *DebianProvisioner) Provision(swarmOptions swarm.SwarmOptions, authOptions auth.AuthOptions, engineOptions engine.EngineOptions) error {
provisioner.SwarmOptions = swarmOptions
provisioner.AuthOptions = authOptions
provisioner.EngineOptions = engineOptions
if provisioner.EngineOptions.StorageDriver == "" {
provisioner.EngineOptions.StorageDriver = "aufs"
}
// HACK: since debian does not come with sudo by default we install
log.Debug("installing sudo")
if _, err := provisioner.SSHCommand("if ! type sudo; then apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y sudo; fi"); err != nil {
return err
}
log.Debug("setting hostname")
if err := provisioner.SetHostname(provisioner.Driver.GetMachineName()); err != nil {
return err
}
log.Debug("installing base packages")
for _, pkg := range provisioner.Packages {
if err := provisioner.Package(pkg, pkgaction.Install); err != nil {
return err
}
}
log.Debug("installing docker")
if err := installDockerGeneric(provisioner, engineOptions.InstallURL); err != nil {
return err
}
log.Debug("waiting for docker daemon")
if err := utils.WaitFor(provisioner.dockerDaemonResponding); err != nil {
return err
}
provisioner.AuthOptions = setRemoteAuthOptions(provisioner)
log.Debug("configuring auth")
if err := ConfigureAuth(provisioner); err != nil {
return err
}
log.Debug("configuring swarm")
if err := configureSwarm(provisioner, swarmOptions, provisioner.AuthOptions); err != nil {
return err
}
// enable in systemd
log.Debug("enabling docker in systemd")
if err := provisioner.Service("docker", serviceaction.Enable); err != nil {
return err
}
return nil
}
开发者ID:justintung,项目名称:machine,代码行数:57,代码来源:debian.go
示例9: Restart
func (d *Driver) Restart() error {
log.Debug("Restarting...")
if _, err := drivers.RunSSHCommandFromDriver(d, "sudo shutdown -r now"); err != nil {
return err
}
return nil
}
开发者ID:cdosso,项目名称:machine,代码行数:9,代码来源:generic.go
示例10: Kill
func (d *Driver) Kill() error {
log.Debug("Killing...")
if _, err := drivers.RunSSHCommandFromDriver(d, "sudo shutdown -P now"); err != nil {
return err
}
return nil
}
开发者ID:cdosso,项目名称:machine,代码行数:9,代码来源:generic.go
示例11: DumpVal
func DumpVal(vals ...interface{}) {
for _, val := range vals {
prettyJSON, err := json.MarshalIndent(val, "", " ")
if err != nil {
log.Fatal(err)
}
log.Debug(string(prettyJSON))
}
}
开发者ID:weiwongfaye,项目名称:learn_go,代码行数:9,代码来源:utils.go
示例12: installOfficialDocker
func (provisioner *RedHatProvisioner) installOfficialDocker() error {
log.Debug("installing docker")
if _, err := provisioner.SSHCommand(fmt.Sprintf("sudo yum install -y --nogpgcheck %s", provisioner.DockerRPMPath)); err != nil {
return err
}
return nil
}
开发者ID:cdosso,项目名称:machine,代码行数:9,代码来源:redhat.go
示例13: GetDvdIso
// GET /dvd_isos/{id}
func (api *API) GetDvdIso(Id string) (*DvdIso, error) {
log.Debug("requesting information about dvd iso", Id)
result := new(DvdIso)
err := api.Client.Get(createUrl(api, "dvd_isos", Id), &result, http.StatusOK)
if err != nil {
return nil, err
}
result.api = api
return result, nil
}
开发者ID:shing19m,项目名称:oneandone-cloudserver-api,代码行数:11,代码来源:dvdisos.go
示例14: CreateServer
// POST /servers
func (api *API) CreateServer(configuration ServerCreateData) (*Server, error) {
log.Debug("requesting to create a new server")
result := new(Server)
err := api.Client.Post(createUrl(api, "servers"), &configuration, &result, http.StatusAccepted)
if err != nil {
return nil, err
}
result.api = api
return result, nil
}
开发者ID:shing19m,项目名称:oneandone-cloudserver-api,代码行数:11,代码来源:servers.go
示例15: Shell
func (client ExternalClient) Shell() error {
cmd := exec.Command(client.BinaryPath, client.BaseArgs...)
log.Debug(cmd)
cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
return cmd.Run()
}
开发者ID:jkingyens,项目名称:machine,代码行数:10,代码来源:client.go
示例16: securityGroupAvailableFunc
func (d *Driver) securityGroupAvailableFunc(id string) func() bool {
return func() bool {
_, err := d.getClient().GetSecurityGroupById(id)
if err == nil {
return true
}
log.Debug(err)
return false
}
}
开发者ID:cdosso,项目名称:machine,代码行数:10,代码来源:amazonec2.go
示例17: GetServerAppliance
// GET /server_appliances/{id}
func (api *API) GetServerAppliance(Id string) (*ServerAppliance, error) {
log.Debug("requesting information about server appliance", Id)
res := new(ServerAppliance)
err := api.Client.Get(createUrl(api, "server_appliances", Id), &res, http.StatusOK)
if err != nil {
return nil, err
}
res.api = api
return res, nil
}
开发者ID:shing19m,项目名称:oneandone-cloudserver-api,代码行数:11,代码来源:serverappliances.go
示例18: Delete
// DELETE /firewall_policies/{id}
func (fwp *FirewallPolicy) Delete() (*FirewallPolicy, error) {
log.Debug("Requested to delete firewall policy ", fwp.Id)
result := new(FirewallPolicy)
err := fwp.api.Client.Delete(createUrl(fwp.api, "firewall_policies", fwp.Id), &result, http.StatusAccepted)
if err != nil {
return nil, err
}
result.api = fwp.api
return result, nil
}
开发者ID:shing19m,项目名称:oneandone-cloudserver-api,代码行数:11,代码来源:firewallpolicies.go
示例19: GetServer
// GET /servers/{id}
func (api *API) GetServer(Id string) (*Server, error) {
log.Debug("requesting information about server ", Id)
result := new(Server)
err := api.Client.Get(createUrl(api, "servers", Id), &result, http.StatusOK)
if err != nil {
return nil, err
}
result.api = api
return result, nil
}
开发者ID:shing19m,项目名称:oneandone-cloudserver-api,代码行数:11,代码来源:servers.go
示例20: instanceIsRunning
func (d *Driver) instanceIsRunning() bool {
st, err := d.GetState()
if err != nil {
log.Debug(err)
}
if st == state.Running {
return true
}
return false
}
开发者ID:cdosso,项目名称:machine,代码行数:10,代码来源:amazonec2.go
注:本文中的github.com/docker/machine/log.Debug函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论