Skip to content

Commit dc0ccfc

Browse files
driver/shelldriver: handle existing /tmp/labgrid-ssh/ gracefully
When activating -> deactivating -> activating a ShellDriver or forcing a strategy shell state that put an SSH key on the target in a prior run, mkdir fails because the directory already exists. That should not be an error, so add `-p` to the mkdir invocation. Signed-off-by: Bastian Krause <[email protected]>
1 parent e43d093 commit dc0ccfc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

labgrid/driver/shelldriver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ def _put_ssh_key(self, keyfile_path):
275275
return
276276

277277
self.logger.debug("Key not on target and not writeable, using bind mount...")
278-
self._run_check('mkdir -m 700 /tmp/labgrid-ssh/')
278+
self._run_check('mkdir -p -m 700 /tmp/labgrid-ssh/')
279279
self._run("cp -a ~/.ssh/* /tmp/labgrid-ssh/")
280280
self._write_key(keyline, "/tmp/labgrid-ssh/authorized_keys")
281281
self._run_check('chmod 600 /tmp/labgrid-ssh/authorized_keys')

0 commit comments

Comments
 (0)