removed the inlining of ssh password for username=rapl. Now we read value of environment variable named RAPL_PSSWD

This commit is contained in:
Pradyumna Kaushik 2017-09-27 19:52:17 -04:00
parent 971f6833c3
commit dcf67661e9
2 changed files with 11 additions and 2 deletions

7
environment/env.go Normal file
View file

@ -0,0 +1,7 @@
package environment
// Environment Variables that are used.
// These environment variables need to be set before launching elektron.
// Environment Variable to store the password for username="rapl" on the nodes in the cluster.
var RaplPassword = "RAPL_PSSWD"

View file

@ -4,6 +4,8 @@ import (
"github.com/pkg/errors"
"golang.org/x/crypto/ssh"
"strconv"
"os"
elekEnv "bitbucket.org/sunybingcloud/elektron/environment"
)
func Cap(host, username string, percentage float64) error {
@ -15,8 +17,8 @@ func Cap(host, username string, percentage float64) error {
sshConfig := &ssh.ClientConfig{
User: username,
Auth: []ssh.AuthMethod{
// TODO: CHANGE and MAKE THIS USE SSH KEY BEFORE MAKING PUBLIC!!!!
ssh.Password("pankajlikesdanceswithwolves#!@#"),
// TODO: CHANGE and MAKE THIS USE SSH KEY!!!!
ssh.Password(os.Getenv(elekEnv.RaplPassword)),
},
}