From 6139fab354b52ca56e5d4ffaea281d83b020a21e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 23 Sep 2011 19:10:07 +0200 Subject: [PATCH] import cdist.path works Signed-off-by: Nico Schottelius --- bin/cdist | 10 +++++----- lib/cdist/path.py | 6 +++++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/bin/cdist b/bin/cdist index 69e0623f..18e7845b 100755 --- a/bin/cdist +++ b/bin/cdist @@ -20,10 +20,6 @@ # # -# Add our own library path -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), - '../lib/python'))) - import argparse import datetime import logging @@ -36,6 +32,10 @@ import stat import sys import tempfile +# Add our own library path +sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), + '../lib'))) + import cdist.path BANNER = """ @@ -95,7 +95,7 @@ class Cdist: self.target_host = target_host self.remote_prefix = ["ssh", "root@" + self.target_host] - self.path_info = cdist.path.Path(target_host, home) + self.path_info = cdist.path.Path(target_host, base_dir=home) # Setup directory paths self.temp_dir = tempfile.mkdtemp() diff --git a/lib/cdist/path.py b/lib/cdist/path.py index e18f6582..5d72a23a 100644 --- a/lib/cdist/path.py +++ b/lib/cdist/path.py @@ -1,3 +1,7 @@ +import os +import sys +import tempfile + # Hardcoded paths usually not changable REMOTE_BASE_DIR = "/var/lib/cdist" REMOTE_CONF_DIR = os.path.join(REMOTE_BASE_DIR, "conf") @@ -31,7 +35,7 @@ class Path: def __init__(self, target_host, base_dir=None): # Base and Temp Base - if home: + if base_dir: self.base_dir = base_dir else: self.base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))