aboutsummaryrefslogtreecommitdiffstats
path: root/vm/isolated
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-05-07 17:59:06 +0200
committerDmitry Vyukov <dvyukov@google.com>2018-05-07 17:59:06 +0200
commit9e0846e8a4beebff36c72f03479a7db775b5144e (patch)
tree5be248f1b661837ea2378648676e3f0f8d5746c6 /vm/isolated
parent99c1f486598445575a3a624bf70dc6a31f60d365 (diff)
all: get rid of underscores in identifiers
Underscores are against Go coding style. Update #538
Diffstat (limited to 'vm/isolated')
-rw-r--r--vm/isolated/isolated.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/vm/isolated/isolated.go b/vm/isolated/isolated.go
index 86adb80dc..f86ec96fd 100644
--- a/vm/isolated/isolated.go
+++ b/vm/isolated/isolated.go
@@ -24,9 +24,9 @@ func init() {
}
type Config struct {
- Targets []string // target machines: (hostname|ip)(:port)?
- Target_Dir string // directory to copy/run on target
- Target_Reboot bool // reboot target on repair
+ Targets []string `json:"targets"` // target machines: (hostname|ip)(:port)?
+ TargetDir string `json:"target_dir"` // directory to copy/run on target
+ TargetReboot bool `json:"target_reboot"` // reboot target on repair
}
type Pool struct {
@@ -52,7 +52,7 @@ func ctor(env *vmimpl.Env) (vmimpl.Pool, error) {
if len(cfg.Targets) == 0 {
return nil, fmt.Errorf("config param targets is empty")
}
- if cfg.Target_Dir == "" {
+ if cfg.TargetDir == "" {
return nil, fmt.Errorf("config param target_dir is empty")
}
for _, target := range cfg.Targets {
@@ -95,10 +95,10 @@ func (pool *Pool) Create(workdir string, index int) (vmimpl.Instance, error) {
}
// Create working dir if doesn't exist.
- inst.ssh("mkdir -p '" + inst.cfg.Target_Dir + "'")
+ inst.ssh("mkdir -p '" + inst.cfg.TargetDir + "'")
// Remove temp files from previous runs.
- inst.ssh("rm -rf '" + filepath.Join(inst.cfg.Target_Dir, "*") + "'")
+ inst.ssh("rm -rf '" + filepath.Join(inst.cfg.TargetDir, "*") + "'")
closeInst = nil
return inst, nil
@@ -168,7 +168,7 @@ func (inst *instance) ssh(command string) error {
func (inst *instance) repair() error {
log.Logf(2, "isolated: trying to ssh")
if err := inst.waitForSSH(30 * 60); err == nil {
- if inst.cfg.Target_Reboot {
+ if inst.cfg.TargetReboot {
log.Logf(2, "isolated: trying to reboot")
inst.ssh("reboot") // reboot will return an error, ignore it
if err := inst.waitForReboot(5 * 60); err != nil {
@@ -233,7 +233,7 @@ func (inst *instance) Close() {
func (inst *instance) Copy(hostSrc string) (string, error) {
baseName := filepath.Base(hostSrc)
- vmDst := filepath.Join(inst.cfg.Target_Dir, baseName)
+ vmDst := filepath.Join(inst.cfg.TargetDir, baseName)
inst.ssh("pkill -9 '" + baseName + "'; rm -f '" + vmDst + "'")
args := append(inst.sshArgs("-P"), hostSrc, inst.target+":"+vmDst)
cmd := osutil.Command("scp", args...)
@@ -281,7 +281,7 @@ func (inst *instance) Run(timeout time.Duration, stop <-chan bool, command strin
proxy := fmt.Sprintf("%v:127.0.0.1:%v", inst.port, inst.port)
args = append(args, "-R", proxy)
}
- args = append(args, inst.target, "cd "+inst.cfg.Target_Dir+" && exec "+command)
+ args = append(args, inst.target, "cd "+inst.cfg.TargetDir+" && exec "+command)
log.Logf(0, "running command: ssh %#v", args)
if inst.debug {
log.Logf(0, "running command: ssh %#v", args)