cdist runs with path module loaded (unusued though)

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-09-23 20:08:55 +02:00
parent 26fad6f23c
commit 79173488ff
2 changed files with 38 additions and 6 deletions

View File

@ -32,11 +32,6 @@ 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 = """
.. . .x+=:. s
@ -788,11 +783,19 @@ def commandline():
args.func(args)
if __name__ == "__main__":
try:
if re.match(TYPE_PREFIX, os.path.basename(sys.argv[0])):
emulator()
else:
# Add our own library path
sys.path.insert(0,
os.path.abspath(os.path.join(os.path.dirname(__file__),
'../lib')))
import cdist.path
commandline()
except KeyboardInterrupt:
sys.exit(0)

View File

@ -1,3 +1,25 @@
# -*- coding: utf-8 -*-
#
# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org)
#
# This file is part of cdist.
#
# cdist is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# cdist is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
#
#
import logging
import os
import sys
import tempfile
@ -13,6 +35,10 @@ CODE_HEADER = "#!/bin/sh -e\n"
DOT_CDIST = ".cdist"
TYPE_PREFIX = "__"
logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s')
log = logging.getLogger()
def file_to_list(filename):
"""Return list from \n seperated file"""
if os.path.isfile(filename):
@ -33,7 +59,10 @@ def file_to_list(filename):
class Path:
"""Class that handles path related configurations"""
def __init__(self, target_host, base_dir=None):
def __init__(self, target_host,
initial_manifest=False, remote_user="root",
base_dir=None, debug=False):
# Base and Temp Base
if base_dir:
self.base_dir = base_dir