Merge pull request #3360 from YorikSar/depend-fix

Remove extra parse-time dependencies [2nd round].
This commit is contained in:
Thomas S Hatch 2013-01-21 09:33:51 -08:00
commit dce5458998
3 changed files with 19 additions and 13 deletions

View File

@ -12,9 +12,18 @@ import time
import urlparse
# import third party libs
import yaml
try:
yaml.Loader = yaml.CLoader
yaml.Dumper = yaml.CDumper
except Exception:
pass
# Import salt libs
import salt.crypt
import salt.loader
import salt.utils
import salt.pillar
from salt.exceptions import SaltClientError
log = logging.getLogger(__name__)
@ -212,12 +221,6 @@ def _append_domain(opts):
def _read_conf_file(path):
import yaml
try:
yaml.Loader = yaml.CLoader
yaml.Dumper = yaml.CDumper
except Exception:
pass
with salt.utils.fopen(path, 'r') as conf_file:
conf_opts = yaml.safe_load(conf_file.read()) or {}
# allow using numeric ids: convert int to string
@ -457,7 +460,6 @@ def apply_master_config(overrides=None, defaults=None):
if len(opts['sock_dir']) > len(opts['cachedir']) + 10:
opts['sock_dir'] = os.path.join(opts['cachedir'], '.salt-unix')
import salt.crypt
opts['aes'] = salt.crypt.Crypticle.generate_key_string()
opts['extension_modules'] = (

View File

@ -30,6 +30,8 @@ except ImportError:
HAS_FNCTL = False
# Import salt libs
import salt.minion
import salt.payload
from salt.exceptions import SaltClientError, CommandNotFoundError
@ -195,8 +197,6 @@ def daemonize_if(opts, **kwargs):
if not 'jid' in data:
return
import salt.minion
import salt.payload
serial = salt.payload.Serial(opts)
proc_dir = salt.minion.get_proc_dir(opts['cachedir'])
fn_ = os.path.join(proc_dir, data['jid'])

View File

@ -23,11 +23,15 @@ def __get_version_info_from_git(version, version_info):
If we can get a version from Git use that instead, otherwise we carry on
'''
try:
from salt.utils import which
git = which('git')
if not git:
process = subprocess.Popen(
'which git',
stdout=subprocess.PIPE,
shell=True
)
git, _ = process.communicate()
if process.poll() != 0:
return version, version_info
git = git[:-1]
process = subprocess.Popen(
[git, 'describe'],