update check in waitForAutoscalingInstances

Change-Id: I83dc3001b09ce68596634190835f119e1acde443
diff --git a/src/com/mirantis/mk/Aws.groovy b/src/com/mirantis/mk/Aws.groovy
index acc33d7..106de4c 100644
--- a/src/com/mirantis/mk/Aws.groovy
+++ b/src/com/mirantis/mk/Aws.groovy
@@ -180,7 +180,7 @@
                 def instances = out['Instances']
 
                 // check all instances are InService
-                if (common.countHashMapEquals(instances, 'LifecycleState', 'InService') == 0) {
+                if (common.countHashMapEquals(instances, 'LifecycleState', 'InService') == out['DesiredCapacity']) {
                     break
                 }
 
diff --git a/src/com/mirantis/mk/Common.groovy b/src/com/mirantis/mk/Common.groovy
index 0597cfa..ee6559e 100644
--- a/src/com/mirantis/mk/Common.groovy
+++ b/src/com/mirantis/mk/Common.groovy
@@ -449,5 +449,5 @@
 
 @NonCPS
 def countHashMapEquals(lm, param, eq) {
-    return lm.stream().filter{i -> !i[param].equals(eq)}.collect(java.util.stream.Collectors.counting())
+    return lm.stream().filter{i -> i[param].equals(eq)}.collect(java.util.stream.Collectors.counting())
 }