Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ For many of these, you can specify an ID number, a full name, or a partial name
| `public_key_path` | none | Auto inferred based on the `private_key_path` | Path to SSH public key that should be installed on the server. |
| `disable_ssh_password` | none | `true` | When set to `true` and SSH keys are provided password auth for SSH is disabled. |
| `api_retries` | none | `5` | How many times to retry API calls on timeouts or rate limits. |
| `interfaces` | none | `public` | A list of network interfaces to create on the linode, conforming to acceptable API definition. |

## Usage

Expand Down Expand Up @@ -121,6 +122,26 @@ platforms:
# ...<snip>...
```

Note on `interfaces`:
By default, a linode is created with a single network interface (eth0) which is
assigned a public IP address. If your test linode requires another network
interface (eth1) to mock a backend network, you may declare it within the platform
definition. If you do this, you should declare _all_ network interfaces, as
shown below.

```yaml
platforms:
- name: debian10
driver:
...
interfaces:
- purpose: public
- purpose: vlan
label: myGreatVLAN
ipam_address: 11.22.33.44/24
...
```

## Development

* Source hosted at [GitHub][repo]
Expand Down
15 changes: 15 additions & 0 deletions lib/kitchen/driver/linode.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ class Linode < Kitchen::Driver::Base
default_config :stackscript_id, nil
default_config :stackscript_data, nil
default_config :swap_size, nil
default_config :interfaces, [
{
"purpose" => "public",
"label" => nil,
"ipam_address" => nil
}
]
default_config :private_ip, false
default_config :authorized_users do
ENV["LINODE_AUTH_USERS"].to_s.split(",")
Expand Down Expand Up @@ -177,6 +184,13 @@ def create_server
info " type: #{config[:type]}"
info " tags: #{config[:tags]}"
info " swap_size: #{config[:swap_size]}" if config[:swap_size]
info " interfaces:"
config[:interfaces].each do |iface|
info " #{iface[:purpose]}"
iface.each do |iface_part, iface_value|
info " #{iface_part}: #{iface_value}"
end
end
info " private_ip: #{config[:private_ip]}" if config[:private_ip]
info " stackscript_id: #{config[:stackscript_id]}" if config[:stackscript_id]
Retryable.retryable do
Expand All @@ -189,6 +203,7 @@ def create_server
stackscript_id: config[:stackscript_id],
stackscript_data: config[:stackscript_data],
swap_size: config[:swap_size],
interfaces: config[:interfaces],
private_ip: config[:private_ip],
root_pass: config[:password],
authorized_keys: config[:public_key_path] ? [open(config[:public_key_path]).read.strip] : [],
Expand Down
2 changes: 1 addition & 1 deletion lib/kitchen/driver/linode_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ module Kitchen

module Driver
# Version string for Linode Kitchen driver
LINODE_VERSION = "0.15.0".freeze
LINODE_VERSION = "0.15.1".freeze
end
end