Merge pull request #589 from saturnism/google-scopes
Add google-scopes option to specify Compute Engine scopes
This commit is contained in:
@@ -37,8 +37,6 @@ const (
|
||||
dockerStopCommand = "sudo service docker stop"
|
||||
)
|
||||
|
||||
const ()
|
||||
|
||||
// NewComputeUtil creates and initializes a ComputeUtil.
|
||||
func newComputeUtil(driver *Driver) (*ComputeUtil, error) {
|
||||
service, err := newGCEService(driver.storePath)
|
||||
@@ -167,6 +165,12 @@ func (c *ComputeUtil) createInstance(d *Driver) error {
|
||||
firewallTargetTag,
|
||||
},
|
||||
},
|
||||
ServiceAccounts: []*raw.ServiceAccount{
|
||||
{
|
||||
Email: "default",
|
||||
Scopes: strings.Split(d.Scopes, ","),
|
||||
},
|
||||
},
|
||||
}
|
||||
disk, err := c.disk()
|
||||
if disk == nil || err != nil {
|
||||
|
||||
@@ -23,6 +23,7 @@ type Driver struct {
|
||||
MachineName string
|
||||
Zone string
|
||||
MachineType string
|
||||
Scopes string
|
||||
DiskSize int
|
||||
storePath string
|
||||
UserName string
|
||||
@@ -42,6 +43,7 @@ type CreateFlags struct {
|
||||
MachineType *string
|
||||
UserName *string
|
||||
Project *string
|
||||
Scopes *string
|
||||
DiskSize *int
|
||||
}
|
||||
|
||||
@@ -79,6 +81,12 @@ func GetCreateFlags() []cli.Flag {
|
||||
Usage: "GCE Project",
|
||||
EnvVar: "GOOGLE_PROJECT",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "google-scopes",
|
||||
Usage: "GCE Scopes (comma-separated if multiple scopes)",
|
||||
Value: "https://www.googleapis.com/auth/devstorage.read_only,https://www.googleapis.com/auth/logging.write",
|
||||
EnvVar: "GOOGLE_SCOPES",
|
||||
},
|
||||
cli.IntFlag{
|
||||
Name: "google-disk-size",
|
||||
Usage: "GCE Instance Disk Size (in GB)",
|
||||
@@ -112,6 +120,7 @@ func (driver *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
|
||||
driver.DiskSize = flags.Int("google-disk-size")
|
||||
driver.UserName = flags.String("google-username")
|
||||
driver.Project = flags.String("google-project")
|
||||
driver.Scopes = flags.String("google-scopes")
|
||||
driver.SwarmMaster = flags.Bool("swarm-master")
|
||||
driver.SwarmHost = flags.String("swarm-host")
|
||||
driver.SwarmDiscovery = flags.String("swarm-discovery")
|
||||
|
||||
Reference in New Issue
Block a user