import cdist.path works

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-09-23 19:10:07 +02:00
parent 8e59f97800
commit 6139fab354
2 changed files with 10 additions and 6 deletions

View file

@ -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 argparse
import datetime import datetime
import logging import logging
@ -36,6 +32,10 @@ import stat
import sys import sys
import tempfile 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 import cdist.path
BANNER = """ BANNER = """
@ -95,7 +95,7 @@ class Cdist:
self.target_host = target_host self.target_host = target_host
self.remote_prefix = ["ssh", "root@" + self.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 # Setup directory paths
self.temp_dir = tempfile.mkdtemp() self.temp_dir = tempfile.mkdtemp()

View file

@ -1,3 +1,7 @@
import os
import sys
import tempfile
# Hardcoded paths usually not changable # Hardcoded paths usually not changable
REMOTE_BASE_DIR = "/var/lib/cdist" REMOTE_BASE_DIR = "/var/lib/cdist"
REMOTE_CONF_DIR = os.path.join(REMOTE_BASE_DIR, "conf") REMOTE_CONF_DIR = os.path.join(REMOTE_BASE_DIR, "conf")
@ -31,7 +35,7 @@ class Path:
def __init__(self, target_host, base_dir=None): def __init__(self, target_host, base_dir=None):
# Base and Temp Base # Base and Temp Base
if home: if base_dir:
self.base_dir = base_dir self.base_dir = base_dir
else: else:
self.base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) self.base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))