Repository: fabfuel/ecs-deploy

Issue:
ECS service Daemon mode
Hello, i set the Service in "DAEMON" mode meaning the # of desired tasks is Automatic (Top right corner at the screen-shot)

![screenshot from 2018-07-02 13-16-44](https://user-images.githubusercontent.com/11332517/42158871-727414ac-7dfa-11e8-8443-8557f4d4aad9.png)


However i'm getting an error when deploying a new tag


**Command**

`ecs deploy --region ${AWS_REGION} ${CLUSTER_NAME} ${ECS_SERVICE_NAME} --tag ${CI_COMMIT_SHA} --timeout 1200`

**Error:**

```
Creating new task definition revision
Successfully created revision: 6

Updating service
An error occurred (InvalidParameterException) when calling the UpdateService operation: The daemon scheduling strategy does not support a desired count for services. Remove the desired count value and try again

```
i must be missing something here
can you please advise on this ?


Discussion:

Patch:
diff --git a/ecs_deploy/ecs.py b/ecs_deploy/ecs.py
index 3cc2633..34b7156 100644
--- a/ecs_deploy/ecs.py
+++ b/ecs_deploy/ecs.py
@@ -55,6 +55,12 @@ class EcsClient(object):
         )
 
     def update_service(self, cluster, service, desired_count, task_definition):
+        if desired_count is None:
+            return self.boto.update_service(
+                cluster=cluster,
+                service=service,
+                taskDefinition=task_definition
+            )
         return self.boto.update_service(
             cluster=cluster,
             service=service,
@@ -77,9 +83,6 @@ class EcsService(dict):
         self._cluster = cluster
         super(EcsService, self).__init__(service_definition, **kwargs)
 
-    def set_desired_count(self, desired_count):
-        self[u'desiredCount'] = desired_count
-
     def set_task_definition(self, task_definition):
         self[u'taskDefinition'] = task_definition.arn
 
@@ -385,11 +388,11 @@ class EcsAction(object):
     def deregister_task_definition(self, task_definition):
         self._client.deregister_task_definition(task_definition.arn)
 
-    def update_service(self, service):
+    def update_service(self, service, desired_count=None):
         response = self._client.update_service(
             cluster=service.cluster,
             service=service.name,
-            desired_count=service.desired_count,
+            desired_count=desired_count,
             task_definition=service.task_definition
         )
         return EcsService(self._cluster_name, response[u'service'])
@@ -451,8 +454,7 @@ class DeployAction(EcsAction):
 class ScaleAction(EcsAction):
     def scale(self, desired_count):
         try:
-            self._service.set_desired_count(desired_count)
-            return self.update_service(self._service)
+            return self.update_service(self._service, desired_count)
         except ClientError as e:
             raise EcsError(str(e))
 


Test patch:
diff --git a/tests/test_ecs.py b/tests/test_ecs.py
index dd3aab5..7f97e09 100644
--- a/tests/test_ecs.py
+++ b/tests/test_ecs.py
@@ -220,12 +220,6 @@ def test_service_init(service):
     assert service[u'taskDefinition'] == TASK_DEFINITION_ARN_1
 
 
-def test_service_set_desired_count(service):
-    assert service.desired_count == DESIRED_COUNT
-    service.set_desired_count(5)
-    assert service.desired_count == 5
-
-
 def test_service_set_task_definition(service, task_definition):
     assert service.task_definition == TASK_DEFINITION_ARN_1
     service.set_task_definition(task_definition)
@@ -610,7 +604,7 @@ def test_update_service(client, service):
     client.update_service.assert_called_once_with(
         cluster=service.cluster,
         service=service.name,
-        desired_count=service.desired_count,
+        desired_count=None,
         task_definition=service.task_definition
     )
 
@@ -647,7 +641,7 @@ def test_is_not_deployed_with_more_than_one_deployment(client, service):
 def test_is_deployed_if_no_tasks_should_be_running(client, service):
     client.list_tasks.return_value = RESPONSE_LIST_TASKS_0
     action = EcsAction(client, CLUSTER_NAME, SERVICE_NAME)
-    service.set_desired_count(0)
+    service[u'desiredCount'] = 0
     is_deployed = action.is_deployed(service)
     assert is_deployed is True
 
@@ -702,7 +696,6 @@ def test_scale_action(client):
     action = ScaleAction(client, CLUSTER_NAME, SERVICE_NAME)
     updated_service = action.scale(5)
 
-    assert action.service.desired_count == 5
     assert isinstance(updated_service, EcsService)
 
     client.describe_services.assert_called_once_with(