Skip to content

Commit

Permalink
Support for Vultr tag
Browse files Browse the repository at this point in the history
Signed-off-by: janeczku <jan@rancher.com>
  • Loading branch information
janeczku committed Jun 18, 2017
1 parent 69126ac commit 155813c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ Command line flags:
- `--vultr-backups`: Enable automatic backups for the VPS.
- `--vultr-userdata`: Path to file with cloud-init user-data.
- `--vultr-snapshot-id`: Using snapshot to create host.
- `--vultr-tag`: Tag to assign to the VPS.
- `--vultr-api-endpoint`: Override default Vultr API endpoint URL.

If the OS ID is not specified, [RancherOS](http://rancher.com/rancher-os/) will be used as operating system for the instance.
Expand Down Expand Up @@ -84,6 +85,7 @@ The operating system must support cloud-init and be configured to use the `ec2`
| `--vultr-backups` | `VULTR_BACKUPS` | `false` |
| `--vultr-userdata` | `VULTR_USERDATA` | - |
| `--vultr-snapshot-id` | `VULTR_SNAPSHOT` | - |
| `--vultr-tag` | `VULTR_TAG` | - |
| `--vultr-api-endpoint` | `VULTR_API_ENDPOINT` | - |

### Find available plans for all Vultr locations
Expand Down
8 changes: 8 additions & 0 deletions vultr.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ type Driver struct {
CustomPxeScript bool
UserDataFile string
SnapshotID string
VultrTag string
client *vultr.Client
}

Expand Down Expand Up @@ -136,6 +137,11 @@ func (d *Driver) GetCreateFlags() []mcnflag.Flag {
Name: "vultr-snapshot-id",
Usage: "ID of an existing Snapshot in your Vultr account.",
},
mcnflag.StringFlag{
EnvVar: "VULTR_TAG",
Name: "vultr-tag",
Usage: "Tag to assign to the VPS.",
},
}
}

Expand Down Expand Up @@ -176,6 +182,7 @@ func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
d.Backups = flags.Bool("vultr-backups")
d.UserDataFile = flags.String("vultr-userdata")
d.SnapshotID = flags.String("vultr-snapshot-id")
d.VultrTag = flags.String("vultr-tag")
d.SwarmMaster = flags.Bool("swarm-master")
d.SwarmHost = flags.String("swarm-host")
d.SwarmDiscovery = flags.String("swarm-discovery")
Expand Down Expand Up @@ -311,6 +318,7 @@ func (d *Driver) Create() error {
Snapshot: d.SnapshotID,
Hostname: d.MachineName,
DontNotifyOnActivate: true,
Tag: d.VultrTag,
})
if err != nil {
return err
Expand Down

0 comments on commit 155813c

Please sign in to comment.