Skip to content

Commit

Permalink
Fixing a typo and spot validUntil parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
PsyanticY committed Feb 20, 2019
2 parents 69b3e40 + 0bf4514 commit 80847e2
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions nixops/backends/ec2.py
Expand Up @@ -725,11 +725,12 @@ def _build_run_instance_request(self, defn, zone, devmap, user_data, ebs_optimiz
if defn.security_groups != [] and defn.security_groups != ["default"]:
raise Exception("‘deployment.ec2.securityGroups’ is incompatible with ‘deployment.ec2.subnetId’")

args['NetworkInterface'] = dict(
args['NetworkInterfaces'] = [dict(
AssociatePublicIpAddress=defn.associate_public_ip_address,
SubnetId=defn.subnet_id,
DeviceIndex=0,
Groups=self.security_groups_to_ids(defn.subnet_id, defn.security_group_ids)
)
)]
else:
args['SecurityGroups'] = defn.security_groups

Expand All @@ -739,10 +740,13 @@ def _build_run_instance_request(self, defn, zone, devmap, user_data, ebs_optimiz
SpotOptions=dict(
MaxPrice=str(defn.spot_instance_price/100.0),
SpotInstanceType=defn.spot_instance_request_type,
ValidUntil=datetime.datetime.now() + datetime.timedelta(0, defn.spot_instance_timeout),
InstanceInterruptionBehavior=defn.spot_instance_interruption_behavior
)
)
if defn.spot_instance_timeout:
args["InstanceMarketOptions"]["SpotOptions"]["ValidUntil"]=(datetime.datetime.utcnow() +
datetime.timedelta(0, defn.spot_instance_timeout)).isoformat()



return args
Expand All @@ -767,7 +771,6 @@ def _wait_for_spot_request_fulfillment(self, request_id):


def create_instance(self, defn, zone, devmap, user_data, ebs_optimized):

# Use a client token to ensure that instance creation is
# idempotent; i.e., if we get interrupted before recording
# the instance ID, we'll get the same instance ID on the
Expand Down

0 comments on commit 80847e2

Please sign in to comment.