Skip to content
This repository has been archived by the owner on Apr 7, 2022. It is now read-only.

Commit

Permalink
make asgs optional
Browse files Browse the repository at this point in the history
  • Loading branch information
manveru committed Aug 3, 2020
1 parent 301b4a1 commit 6dbf04a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
24 changes: 13 additions & 11 deletions src/bitte/cli/rebuild.cr
Expand Up @@ -40,17 +40,19 @@ module Bitte
sleep(ch_count * 2) # this works around https://github.com/NixOS/nix/issues/3794
end

cluster.asgs.each do |name, asg|
asg.instances.each do |instance|
next if skip?(name)
ch_count += 1
parallel_copy channel: ch,
name: instance.name,
ip: instance.public_ip.not_nil!,
flake: flake,
flake_attr: asg.flake_attr,
uid: asg.uid
sleep(ch_count * 2) # this works around https://github.com/NixOS/nix/issues/3794
if asgs = cluster.asgs
asgs.each do |name, asg|
asg.instances.each do |instance|
next if skip?(name)
ch_count += 1
parallel_copy channel: ch,
name: instance.name,
ip: instance.public_ip.not_nil!,
flake: flake,
flake_attr: asg.flake_attr,
uid: asg.uid
sleep(ch_count * 2) # this works around https://github.com/NixOS/nix/issues/3794
end
end
end

Expand Down
4 changes: 3 additions & 1 deletion src/bitte/cli/ssh-for-each.cr
Expand Up @@ -21,7 +21,9 @@ module Bitte
parallel_ssh ch, name, instance.public_ip, @argv.map(&.to_s)
end

cluster.asgs.each do |name, asg|
return unless asgs = cluster.asgs

asgs.each do |name, asg|
asg.instances.each do |instance|
next unless ip = instance.public_ip
ch_count += 1
Expand Down
5 changes: 3 additions & 2 deletions src/bitte/cluster.cr
Expand Up @@ -8,14 +8,15 @@ module Bitte
mem = IO::Memory.new
sh!("terraform", args: ["output", "-json", "cluster"], output: mem)
from_json(mem.to_s).tap do |cluster|
cluster.asgs.each do |name, asg|
next unless asgs = cluster.asgs
asgs.each do |name, asg|
asg.cluster = cluster
asg.name = name
end
end
end

property asgs : Hash(String, ASG)
property asgs : Hash(String, ASG)?
property flake : String
property instances : Hash(String, Instance)
property kms : String
Expand Down

0 comments on commit 6dbf04a

Please sign in to comment.