shell: Honor SSH_PRIVATE_KEY environment variable
Signed-off-by: Daniel Wagner <daniel.wagner@siemens.com>
This commit is contained in:
parent
bef5aa80b3
commit
415e0bf114
@ -25,6 +25,7 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import os
|
||||||
from kas.libkas import kasplugin
|
from kas.libkas import kasplugin
|
||||||
from kas.config import Config
|
from kas.config import Config
|
||||||
from kas.libcmds import (Macro, Command, SetupDir, SetupProxy, SetupEnviron,
|
from kas.libcmds import (Macro, Command, SetupDir, SetupProxy, SetupEnviron,
|
||||||
@ -77,21 +78,29 @@ class Shell:
|
|||||||
|
|
||||||
macro = Macro()
|
macro = Macro()
|
||||||
|
|
||||||
|
# Prepare
|
||||||
if not args.keep_config_unchanged:
|
if not args.keep_config_unchanged:
|
||||||
macro.add(SetupDir())
|
macro.add(SetupDir())
|
||||||
|
|
||||||
macro.add(SetupProxy())
|
macro.add(SetupProxy())
|
||||||
macro.add(SetupEnviron())
|
macro.add(SetupEnviron())
|
||||||
|
|
||||||
|
if 'SSH_PRIVATE_KEY' in os.environ:
|
||||||
|
macro.add(SetupSSHAgent())
|
||||||
|
|
||||||
if not args.keep_config_unchanged:
|
if not args.keep_config_unchanged:
|
||||||
macro.add(ReposFetch())
|
macro.add(ReposFetch())
|
||||||
macro.add(ReposCheckout())
|
macro.add(ReposCheckout())
|
||||||
macro.add(SetupEnviron())
|
macro.add(SetupEnviron())
|
||||||
macro.add(WriteConfig())
|
macro.add(WriteConfig())
|
||||||
|
|
||||||
|
# Shell
|
||||||
macro.add(SetupHome())
|
macro.add(SetupHome())
|
||||||
macro.add(ShellCommand(args.command))
|
macro.add(ShellCommand(args.command))
|
||||||
|
|
||||||
|
if 'SSH_PRIVATE_KEY' in os.environ:
|
||||||
|
macro.add(CleanupSSHAgent())
|
||||||
|
|
||||||
macro.run(cfg, args.skip)
|
macro.run(cfg, args.skip)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
Loading…
Reference in New Issue
Block a user