Skip to content

Commit

Permalink
remove context from shell
Browse files Browse the repository at this point in the history
Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
  • Loading branch information
Nico Schottelius committed Aug 18, 2013
1 parent a7fe8b4 commit b9a6cf7
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions cdist/shell.py
Expand Up @@ -24,7 +24,7 @@
import subprocess

# initialise cdist
import cdist.context
import cdist.exec.local

This comment has been minimized.

Copy link
@yuyichao

yuyichao Sep 3, 2013

Probably missing ".exec" below?

This comment has been minimized.

Copy link
@telmich

telmich Sep 3, 2013

Contributor

You are right - it's fixed in a4151fe.



# FIXME: only considering config here - enable
Expand All @@ -41,7 +41,7 @@ def __init__(self, shell=None):
self.shell = shell

self.target_host = "cdist-shell-no-target-host"
self.context = cdist.context.Context(
self.local = cdist.local.Local(
target_host=self.target_host,
remote_copy=cdist.REMOTE_COPY,
remote_exec=cdist.REMOTE_EXEC)
Expand All @@ -57,18 +57,18 @@ def _init_shell(self):
self.shell = "/bin/sh"

def _init_files_dirs(self):
self.context.local.create_files_dirs()
self.local.create_files_dirs()

def _init_environment(self):
self.env = os.environ.copy()
additional_env = {
'PATH': "%s:%s" % (self.context.local.bin_path, os.environ['PATH']),
'__cdist_type_base_path': self.context.local.type_path, # for use in type emulator
'PATH': "%s:%s" % (self.local.bin_path, os.environ['PATH']),
'__cdist_type_base_path': self.local.type_path, # for use in type emulator
'__cdist_manifest': "cdist shell",
'__global': self.context.local.out_path,
'__global': self.local.out_path,
'__target_host': self.target_host,
'__manifest': self.context.local.manifest_path,
'__explorer': self.context.local.global_explorer_path,
'__manifest': self.local.manifest_path,
'__explorer': self.local.global_explorer_path,
}

self.env.update(additional_env)
Expand All @@ -79,7 +79,7 @@ def run(self):
self._init_environment()

log.info("Starting shell...")
self.context.local.run([self.shell], self.env)
self.local.run([self.shell], self.env)
log.info("Finished shell.")

@classmethod
Expand Down

0 comments on commit b9a6cf7

Please sign in to comment.