Skip to content

Commit cea1642

Browse files
Prepare release 3.0.0
- document key matching behaviour - bump versions in README.md - treat matched key like an existing key
1 parent 41a5a32 commit cea1642

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ You can find sources and pre-compiled binaries [here](https://github.com/JonasPr
1515

1616
```bash
1717
# Download the binary (this example downloads the binary for linux amd64)
18-
$ wget https://github.com/JonasProgrammer/docker-machine-driver-hetzner/releases/download/2.1.0/docker-machine-driver-hetzner_2.1.0_linux_amd64.tar.gz
19-
$ tar -xvf docker-machine-driver-hetzner_2.1.0_linux_amd64.tar.gz
18+
$ wget https://github.com/JonasProgrammer/docker-machine-driver-hetzner/releases/download/3.0.0/docker-machine-driver-hetzner_3.0.0_linux_amd64.tar.gz
19+
$ tar -xvf docker-machine-driver-hetzner_3.0.0_linux_amd64.tar.gz
2020

2121
# Make it executable and copy the binary in a directory accessible with your $PATH
2222
$ chmod +x docker-machine-driver-hetzner
@@ -95,7 +95,7 @@ $ docker-machine create \
9595
- `--hetzner-image-id`: The id of the Hetzner cloud image (or snapshot) to use, see [Images API](https://docs.hetzner.cloud/#resources-images-get) for how to get a list (mutually excludes `--hetzner-image`).
9696
- `--hetzner-server-type`: The type of the Hetzner Cloud server, see [Server Types API](https://docs.hetzner.cloud/#resources-server-types-get) for how to get a list (defaults to `cx11`).
9797
- `--hetzner-server-location`: The location to create the server in, see [Locations API](https://docs.hetzner.cloud/#resources-locations-get) for how to get a list.
98-
- `--hetzner-existing-key-path`: Use an existing (local) SSH key instead of generating a new keypair.
98+
- `--hetzner-existing-key-path`: Use an existing (local) SSH key instead of generating a new keypair. If a remote key with a matching fingerprint exists, it will be used as if specified using `--hetzner-existing-key-id`, rather than uploading a new key.
9999
- `--hetzner-existing-key-id`: **requires `--hetzner-existing-key-path`**. Use an existing (remote) SSH key instead of uploading the imported key pair,
100100
see [SSH Keys API](https://docs.hetzner.cloud/#resources-ssh-keys-get) for how to get a list
101101
- `--hetzner-user-data`: Cloud-init based User data

driver.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,15 +253,18 @@ func (d *Driver) Create() error {
253253
key, _, err = d.getClient().SSHKey.Create(context.Background(), keyopts)
254254
if err != nil {
255255
return errors.Wrap(err, "could not create ssh key")
256+
} else if key == nil {
257+
return errors.Errorf("key upload did not return an error, but key was nil")
256258
}
259+
260+
d.danglingKey = true
261+
defer d.destroyDanglingKey()
257262
} else {
263+
d.IsExistingKey = true
258264
log.Debugf("SSH key found in Hetzner. ID: %d", key.ID)
259265
}
260266

261267
d.KeyID = key.ID
262-
d.danglingKey = true
263-
264-
defer d.destroyDanglingKey()
265268
}
266269

267270
log.Infof("Creating Hetzner server...")

0 commit comments

Comments
 (0)