Skip to content

Commit

Permalink
droplet.py: Override set_common_state to actually use auth_token
Browse files Browse the repository at this point in the history
  • Loading branch information
adisbladis committed Jul 13, 2020
1 parent ebc8f88 commit ae4fdaa
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion nixops_digitalocean/backends/droplet.py
Expand Up @@ -64,7 +64,7 @@ def get_type(cls) -> str:

def __init__(self, name: str, config: ResourceEval):
super().__init__(name, config)
self.auth_token = self.config.droplet.authToken
self.auth_token = self.config.droplet.authToken.strip()
self.region = self.config.droplet.region
self.size = self.config.droplet.size
self.enable_ipv6 = self.config.droplet.enableIpv6
Expand Down Expand Up @@ -165,6 +165,10 @@ def create_after(self, resources, defn) -> Set:
if isinstance(r, ssh_keypair.SSHKeyPairState)
}

def set_common_state(self, defn: DropletDefinition) -> None:
super().set_common_state(defn)
self.auth_token = defn.auth_token

def get_auth_token(self) -> Optional[str]:
return os.environ.get("DIGITAL_OCEAN_AUTH_TOKEN", self.auth_token)

Expand Down

0 comments on commit ae4fdaa

Please sign in to comment.