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 os
|
||||
from kas.libkas import kasplugin
|
||||
from kas.config import Config
|
||||
from kas.libcmds import (Macro, Command, SetupDir, SetupProxy, SetupEnviron,
|
||||
@ -77,21 +78,29 @@ class Shell:
|
||||
|
||||
macro = Macro()
|
||||
|
||||
# Prepare
|
||||
if not args.keep_config_unchanged:
|
||||
macro.add(SetupDir())
|
||||
|
||||
macro.add(SetupProxy())
|
||||
macro.add(SetupEnviron())
|
||||
|
||||
if 'SSH_PRIVATE_KEY' in os.environ:
|
||||
macro.add(SetupSSHAgent())
|
||||
|
||||
if not args.keep_config_unchanged:
|
||||
macro.add(ReposFetch())
|
||||
macro.add(ReposCheckout())
|
||||
macro.add(SetupEnviron())
|
||||
macro.add(WriteConfig())
|
||||
|
||||
# Shell
|
||||
macro.add(SetupHome())
|
||||
macro.add(ShellCommand(args.command))
|
||||
|
||||
if 'SSH_PRIVATE_KEY' in os.environ:
|
||||
macro.add(CleanupSSHAgent())
|
||||
|
||||
macro.run(cfg, args.skip)
|
||||
|
||||
return True
|
||||
|
Loading…
Reference in New Issue
Block a user