From 47d44710eac3cde0619c5258c3d6c2e4ce6757e1 Mon Sep 17 00:00:00 2001 From: Anders Brujordet Date: Thu, 23 Jun 2016 13:20:46 +0200 Subject: [PATCH] Removing the handling of the docker service from the DockerBakeHandler (#112) --- .../providers/docker/DockerBakeHandler.groovy | 7 ------- .../docker/DockerBakeHandlerSpec.groovy | 18 +++++------------- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/rosco-core/src/main/groovy/com/netflix/spinnaker/rosco/providers/docker/DockerBakeHandler.groovy b/rosco-core/src/main/groovy/com/netflix/spinnaker/rosco/providers/docker/DockerBakeHandler.groovy index 46caaba98..1b9a9344a 100644 --- a/rosco-core/src/main/groovy/com/netflix/spinnaker/rosco/providers/docker/DockerBakeHandler.groovy +++ b/rosco-core/src/main/groovy/com/netflix/spinnaker/rosco/providers/docker/DockerBakeHandler.groovy @@ -30,8 +30,6 @@ public class DockerBakeHandler extends CloudProviderBakeHandler { private static final String BUILDER_TYPE = "docker" private static final String IMAGE_NAME_TOKEN = "Repository:" - static final String START_DOCKER_SERVICE_BASE_COMMAND = "sudo service docker start ; " - @Autowired RoscoDockerConfiguration.DockerBakeryDefaults dockerBakeryDefaults @@ -74,11 +72,6 @@ public class DockerBakeHandler extends CloudProviderBakeHandler { ] } - @Override - String getBaseCommand() { - return START_DOCKER_SERVICE_BASE_COMMAND - } - @Override String getTemplateFileName() { return dockerBakeryDefaults.templateFile diff --git a/rosco-core/src/test/groovy/com/netflix/spinnaker/rosco/providers/docker/DockerBakeHandlerSpec.groovy b/rosco-core/src/test/groovy/com/netflix/spinnaker/rosco/providers/docker/DockerBakeHandlerSpec.groovy index 089d4fb82..73763e8a5 100644 --- a/rosco-core/src/test/groovy/com/netflix/spinnaker/rosco/providers/docker/DockerBakeHandlerSpec.groovy +++ b/rosco-core/src/test/groovy/com/netflix/spinnaker/rosco/providers/docker/DockerBakeHandlerSpec.groovy @@ -174,9 +174,7 @@ class DockerBakeHandlerSpec extends Specification { then: 1 * imageNameFactoryMock.deriveImageNameAndAppVersion(bakeRequest, _) >> [targetImageName, null, PACKAGES_NAME] - 1 * packerCommandFactoryMock.buildPackerCommand(DockerBakeHandler.START_DOCKER_SERVICE_BASE_COMMAND, - parameterMap, - "$configDir/$dockerBakeryDefaults.templateFile") + 1 * packerCommandFactoryMock.buildPackerCommand("", parameterMap, "$configDir/$dockerBakeryDefaults.templateFile") } void 'produces packer command with all required parameters for trusty'() { @@ -210,9 +208,7 @@ class DockerBakeHandlerSpec extends Specification { then: 1 * imageNameFactoryMock.deriveImageNameAndAppVersion(bakeRequest, _) >> [targetImageName, null, PACKAGES_NAME] - 1 * packerCommandFactoryMock.buildPackerCommand(DockerBakeHandler.START_DOCKER_SERVICE_BASE_COMMAND, - parameterMap, - "$configDir/$dockerBakeryDefaults.templateFile") + 1 * packerCommandFactoryMock.buildPackerCommand("", parameterMap, "$configDir/$dockerBakeryDefaults.templateFile") } void 'produces packer command with all required parameters for centos'() { @@ -246,9 +242,7 @@ class DockerBakeHandlerSpec extends Specification { then: 1 * imageNameFactoryMock.deriveImageNameAndAppVersion(bakeRequest, _) >> [targetImageName, null, PACKAGES_NAME] - 1 * packerCommandFactoryMock.buildPackerCommand(DockerBakeHandler.START_DOCKER_SERVICE_BASE_COMMAND, - parameterMap, - "$configDir/$dockerBakeryDefaults.templateFile") + 1 * packerCommandFactoryMock.buildPackerCommand("", parameterMap, "$configDir/$dockerBakeryDefaults.templateFile") } void 'produces packer command with all required parameters including appversion and build_host for trusty'() { @@ -289,9 +283,7 @@ class DockerBakeHandlerSpec extends Specification { then: 1 * imageNameFactoryMock.deriveImageNameAndAppVersion(bakeRequest, _) >> [targetImageName, appVersionStr, fullyQualifiedPackageName] - 1 * packerCommandFactoryMock.buildPackerCommand(DockerBakeHandler.START_DOCKER_SERVICE_BASE_COMMAND, - parameterMap, - "$configDir/$dockerBakeryDefaults.templateFile") + 1 * packerCommandFactoryMock.buildPackerCommand("", parameterMap, "$configDir/$dockerBakeryDefaults.templateFile") } void 'throws exception when virtualization settings are not found for specified operating system'() { @@ -310,7 +302,7 @@ class DockerBakeHandlerSpec extends Specification { debianRepository: DEBIAN_REPOSITORY) when: - dockerBakeHandler.producePackerCommand(DockerBakeHandler.START_DOCKER_SERVICE_BASE_COMMAND, bakeRequest) + dockerBakeHandler.producePackerCommand(REGION, bakeRequest) then: IllegalArgumentException e = thrown()