hako 1.3.2 → 1.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1c3cbac9e99948d6066a1298afe5ca3076760291
4
- data.tar.gz: b0839a1b24e6999fb06bdd966d91361920a62410
3
+ metadata.gz: e670cdac7ce5a24b4d82bc026eceaa8068b6422f
4
+ data.tar.gz: 6b5a6ca2de09ae0a680e4ff1de903798cb04c78d
5
5
  SHA512:
6
- metadata.gz: b37865f52d9b2c08d2892659d1cfe7b0706f08ba62e8ec44102e27a347b91ce334d1dfeafe5583c0dc3169848c3180ae291c2efa0cb0bbf95a6afd29f0905a47
7
- data.tar.gz: aca7ab571e6f2a6d3d584f303430a17eaf2d5c435e67ec08912512a0e991465cdc2188b62f1bac0dc8b00954295accdfb15d8ec6d05dc0bf60475bddb5dc6470
6
+ metadata.gz: 2ca1d9c75bbc08407d04f1dbc510f695c24b84fb45b8ea03bd56562d7049e010f214dbc8514f413350a880892fbad2f6780ae368cff1e7e4491177c763b6d0cd
7
+ data.tar.gz: 6871ae244cf85ac56ff6256fbe6799b1f39540f9823a1288e97b9c67bda32301c32829ecd7cb9b06ebbc0b5dca1df0b86d4b5df48abba4f351a2f92c5b078a5a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # 1.3.3 (2017-05-23)
2
+ ## Bug fixes
3
+ - Fix error of autoscaling for oneshot when container instances are empty
4
+ - Fix error when new task definition is registered
5
+ - Regression in v1.3.2
6
+
1
7
  # 1.3.2 (2017-05-23)
2
8
  ## Bug fixes
3
9
  - Pass placement_configurations in oneshot mode
@@ -357,6 +357,10 @@ module Hako
357
357
  if @force
358
358
  return true
359
359
  end
360
+ if !actual_definition
361
+ # Initial deployment
362
+ return true
363
+ end
360
364
  container_definitions = {}
361
365
  actual_definition.container_definitions.each do |c|
362
366
  container_definitions[c.name] = c
@@ -372,9 +376,6 @@ module Hako
372
376
  return true
373
377
  end
374
378
  !container_definitions.empty?
375
- rescue Aws::ECS::Errors::ClientException
376
- # Task definition does not exist
377
- true
378
379
  end
379
380
 
380
381
  # @param [Hash<String, Hash<String, String>>] actual_volumes
@@ -406,7 +407,7 @@ module Hako
406
407
  # @param [Array<Hash>] definitions
407
408
  # @return [Array<Boolean, Aws::ECS::Types::TaskDefinition>]
408
409
  def register_task_definition(definitions)
409
- current_task_definition = ecs_client.describe_task_definition(task_definition: @app_id).task_definition
410
+ current_task_definition = describe_task_definition(@app_id)
410
411
  if task_definition_changed?(definitions, current_task_definition)
411
412
  new_task_definition = ecs_client.register_task_definition(
412
413
  family: @app_id,
@@ -432,7 +433,7 @@ module Hako
432
433
  # @return [Array<Boolean, Aws::ECS::Types::TaskDefinition]
433
434
  def register_task_definition_for_oneshot(definitions)
434
435
  family = "#{@app_id}-oneshot"
435
- current_task_definition = ecs_client.describe_task_definition(task_definition: family).task_definition
436
+ current_task_definition = describe_task_definition(family)
436
437
  if task_definition_changed?(definitions, current_task_definition)
437
438
  new_task_definition = ecs_client.register_task_definition(
438
439
  family: family,
@@ -456,6 +457,13 @@ module Hako
456
457
  end
457
458
  end
458
459
 
460
+ def describe_task_definition(family)
461
+ ecs_client.describe_task_definition(task_definition: family).task_definition
462
+ rescue Aws::ECS::Errors::ClientException
463
+ # Task definition does not exist
464
+ nil
465
+ end
466
+
459
467
  # @param [String] name
460
468
  # @param [Container] container
461
469
  # @return [Hash]
@@ -841,7 +849,13 @@ module Hako
841
849
  raise Error.new("AutoScaling Group '#{@autoscaling_group_for_oneshot}' does not exist")
842
850
  end
843
851
 
844
- container_instances = ecs_client.list_container_instances(cluster: @cluster).flat_map { |c| ecs_client.describe_container_instances(cluster: @cluster, container_instances: c.container_instance_arns).container_instances }
852
+ container_instances = ecs_client.list_container_instances(cluster: @cluster).flat_map do |c|
853
+ if c.container_instance_arns.empty?
854
+ []
855
+ else
856
+ ecs_client.describe_container_instances(cluster: @cluster, container_instances: c.container_instance_arns).container_instances
857
+ end
858
+ end
845
859
  if has_capacity?(task_definition, container_instances)
846
860
  Hako.logger.info("There's remaining capacity. Start retrying...")
847
861
  return true
data/lib/hako/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Hako
4
- VERSION = '1.3.2'
4
+ VERSION = '1.3.3'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hako
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kohei Suzuki