Modify ssh key command generation 91/1191/1
authorYolanda Robla <yroblamo@redhat.com>
Mon, 15 Jul 2019 16:57:04 +0000 (18:57 +0200)
committerYolanda Robla <yroblamo@redhat.com>
Mon, 15 Jul 2019 16:58:35 +0000 (18:58 +0200)
There was a problem with the current command and
the quotes, modify the way of generating it.

Signed-off-by: Yolanda Robla <yroblamo@redhat.com>
Change-Id: I21531e01c062ae1e46c93d50b7f7ef5bd9df5b49

pkg/utils/utils.go

index 4fa2805..e72f43a 100644 (file)
@@ -21,7 +21,7 @@ func ValidateRequirements(buildPath string, siteName string) {
        if _, err := os.Stat(fmt.Sprintf("%s/id_rsa.pub", buildPath)); os.IsNotExist(err) {
                log.Println(fmt.Sprintf("No SSH public key (id_rsa.pub) found in %s. Generating keypair.", buildPath))
 
-               cmd := exec.Command("ssh-keygen", "-b", "2048", "-f", fmt.Sprintf("%s/id_rsa", buildPath), "-C", "user@example.com", "-q", "-N", "\"\"")
+               cmd := exec.Command("/bin/bash", "-c", fmt.Sprintf("ssh-keygen -b 2048 -q -N '' -f %s/id_rsa -C user@example.com", buildPath))
                err = cmd.Run()
                if err != nil {
                        log.Fatal(fmt.Sprintf("Error generating ssh keypair: %s", err))