Skip to content

Commit

Permalink
digital ocean: enp0s3 -> ens3
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel Leathers authored and rbvermaa committed Jan 16, 2018
1 parent e93ef69 commit 32d78e4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions nixops/backends/digital_ocean.py
Expand Up @@ -8,7 +8,7 @@
I hit a few subtle problems along the way:
* DO doesn't do dhcp so we have to hard-code the network configuration
* Ubuntu still uses eth0, 1 etc, not enp0s3 etc so we have a network
* Ubuntu still uses eth0, 1 etc, not ens3 etc so we have a network
link name change after the reboot.
* I had to modify nixos-infect to reflect the network link name changes,
and to not reboot to avoid ssh-interruption and therefore errors.
Expand Down Expand Up @@ -86,10 +86,10 @@ def prefix_len(netmask):
networking = {
'defaultGateway': self.default_gateway,
'nameservers': ['8.8.8.8'], # default provided by DO
('interfaces', 'enp0s3', 'ip4'): [{"address": self.public_ipv4, 'prefixLength': prefix_len(self.netmask)}],
('interfaces', 'ens3', 'ip4'): [{"address": self.public_ipv4, 'prefixLength': prefix_len(self.netmask)}],
}
if self.public_ipv6:
networking[('interfaces', 'enp0s3', 'ip6')] = [{'address': self.public_ipv6['address'], 'prefixLength': self.public_ipv6['prefixLength']}]
networking[('interfaces', 'ens3', 'ip6')] = [{'address': self.public_ipv6['address'], 'prefixLength': self.public_ipv6['prefixLength']}]
if self.default_gateway6:
networking['defaultGateway6'] = self.default_gateway6

Expand Down Expand Up @@ -188,7 +188,7 @@ def create(self, defn, check, allow_reboot, allow_recreate):

# run modified nixos-infect
# - no reboot
# - predictable network interface naming (enp0s3 etc)
# - predictable network interface naming (ens3 etc)
self.wait_for_ssh()
self.log_start("running nixos-infect")
self.run_command('bash </dev/stdin 2>&1', stdin=open(infect_path))
Expand Down

0 comments on commit 32d78e4

Please sign in to comment.