Skip to content

Commit 64fed16

Browse files
author
Quentin Perez
committed
Merge pull request #25 from scaleway/scaleway-debug
Scaleway debug
2 parents ffdc59d + 5b22078 commit 64fed16

File tree

2 files changed

+28
-6
lines changed

2 files changed

+28
-6
lines changed

README.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ Options:
5151
--engine-registry-mirror [--engine-registry-mirror option --engine-registry-mirror option] Specify registry mirrors to use [$ENGINE_REGISTRY_MIRROR]
5252
--engine-storage-driver Specify a storage driver to use with the engine
5353
--scaleway-commercial-type "VC1S" Specifies the commercial type [$SCALEWAY_COMMERCIAL_TYPE]
54+
--scaleway-debug Enables Scaleway client debugging [$SCALEWAY_DEBUG]
5455
--scaleway-image "ubuntu-trusty" Specifies the image [$SCALEWAY_IMAGE]
5556
--scaleway-name Assign a name [$SCALEWAY_NAME]
5657
--scaleway-organization Scaleway organization [$SCALEWAY_ORGANIZATION]
@@ -117,12 +118,14 @@ $> curl --silent http://212.47.248.251 | head -n1 # you can also open your brows
117118

118119
## Options
119120

120-
|Option Name |Description |Default Value|required|
121-
|----------------------------------------------------------------|-------------------|-------------|--------|
122-
|``--scaleway-organization`` or ``$SCALEWAY_ORGANIZATION`` |Organization UUID |none |yes |
123-
|``--scaleway-token`` or ``$SCALEWAY_TOKEN`` |Token UUID |none |yes |
124-
|``--scaleway-name`` or ``$SCALEWAY_NAME`` |Server name |none |no |
125-
|``--scaleway-commercial-type`` or ``$SCALEWAY_COMMERCIAL_TYPE`` |Commercial type |VC1S |no |
121+
|Option Name |Description |Default Value |required|
122+
|----------------------------------------------------------------|-------------------|--------------|--------|
123+
|``--scaleway-organization`` or ``$SCALEWAY_ORGANIZATION`` |Organization UUID |none |yes |
124+
|``--scaleway-token`` or ``$SCALEWAY_TOKEN`` |Token UUID |none |yes |
125+
|``--scaleway-name`` or ``$SCALEWAY_NAME`` |Server name |none |no |
126+
|``--scaleway-commercial-type`` or ``$SCALEWAY_COMMERCIAL_TYPE`` |Commercial type |VC1S |no |
127+
|``--scaleway-image`` or ``$SCALEWAY_IMAGE`` |Server image |ubuntu-trusty |no |
128+
|``--scaleway-debug`` or ``$SCALEWAY_DEBUG`` |Toggle debugging |false |no |
126129

127130
---
128131

@@ -131,6 +134,7 @@ $> curl --silent http://212.47.248.251 | head -n1 # you can also open your brows
131134
### master (unreleased)
132135

133136
* Add `--scaleway-image` ([#22](https://github.com/scaleway/docker-machine-driver-scaleway/issues/22))
137+
* Add `--scaleway-debug`
134138

135139
View full [commits list](https://github.com/scaleway/docker-machine-driver-scaleway/compare/v1.0.2...master)
136140

@@ -163,6 +167,12 @@ View full [commits list](https://github.com/scaleway/docker-machine-driver-scale
163167

164168
---
165169

170+
## Debugging
171+
172+
```console
173+
$ SCALEWAY_DEBUG=1 MACHINE_DEBUG=1 docker-machine ...
174+
```
175+
166176
## Development
167177

168178
Feel free to contribute :smiley::beers:

driver/scaleway.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ import (
55
"fmt"
66
"io/ioutil"
77
"net"
8+
"os"
89
"strings"
910
"time"
1011

12+
"github.com/Sirupsen/logrus"
1113
"github.com/docker/machine/libmachine/drivers"
1214
"github.com/docker/machine/libmachine/log"
1315
"github.com/docker/machine/libmachine/mcnflag"
@@ -57,6 +59,11 @@ func (d *Driver) getClient() (cl *api.ScalewayAPI, err error) {
5759

5860
// SetConfigFromFlags sets the flags
5961
func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) (err error) {
62+
if flags.Bool("scaleway-debug") {
63+
logrus.SetOutput(os.Stderr)
64+
logrus.SetLevel(logrus.DebugLevel)
65+
}
66+
6067
d.Token, d.Organization = flags.String("scaleway-token"), flags.String("scaleway-organization")
6168
if d.Token == "" || d.Organization == "" {
6269
config, cfgErr := config.GetConfig()
@@ -114,6 +121,11 @@ func (d *Driver) GetCreateFlags() []mcnflag.Flag {
114121
Usage: "Specifies the image",
115122
Value: defaultImage,
116123
},
124+
mcnflag.BoolFlag{
125+
EnvVar: "SCALEWAY_DEBUG",
126+
Name: "scaleway-debug",
127+
Usage: "Enables Scaleway client debugging",
128+
},
117129
// mcnflag.StringFlag{
118130
// EnvVar: "SCALEWAY_USERDATA",
119131
// Name: "scaleway-userdata",

0 commit comments

Comments
 (0)