Code Duplication    Length = 10-11 lines in 2 locations

ecs_deploy/ecs.py 2 locations

@@ 216-226 (lines=11) @@
213
                )
214
                self._diff.append(diff)
215
                container[u'image'] = new_image
216
            elif tag:
217
                image_definition = container[u'image'].rsplit(u':', 1)
218
                new_image = u'%s:%s' % (image_definition[0], tag.strip())
219
                diff = EcsTaskDefinitionDiff(
220
                    container=container[u'name'],
221
                    field=u'image',
222
                    value=new_image,
223
                    old_value=container[u'image']
224
                )
225
                self._diff.append(diff)
226
                container[u'image'] = new_image
227
228
    def set_commands(self, **commands):
229
        self.validate_container_options(**commands)
@@ 231-240 (lines=10) @@
228
    def set_commands(self, **commands):
229
        self.validate_container_options(**commands)
230
        for container in self.containers:
231
            if container[u'name'] in commands:
232
                new_command = commands[container[u'name']]
233
                diff = EcsTaskDefinitionDiff(
234
                    container=container[u'name'],
235
                    field=u'command',
236
                    value=new_command,
237
                    old_value=container.get(u'command')
238
                )
239
                self._diff.append(diff)
240
                container[u'command'] = [new_command]
241
242
    def set_environment(self, environment_list):
243
        environment = {}