mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
Merge pull request #3360 from YorikSar/depend-fix
Remove extra parse-time dependencies [2nd round].
This commit is contained in:
commit
dce5458998
@ -12,9 +12,18 @@ import time
|
|||||||
import urlparse
|
import urlparse
|
||||||
|
|
||||||
# import third party libs
|
# import third party libs
|
||||||
|
import yaml
|
||||||
|
try:
|
||||||
|
yaml.Loader = yaml.CLoader
|
||||||
|
yaml.Dumper = yaml.CDumper
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
# Import salt libs
|
# Import salt libs
|
||||||
|
import salt.crypt
|
||||||
|
import salt.loader
|
||||||
import salt.utils
|
import salt.utils
|
||||||
|
import salt.pillar
|
||||||
from salt.exceptions import SaltClientError
|
from salt.exceptions import SaltClientError
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -212,12 +221,6 @@ def _append_domain(opts):
|
|||||||
|
|
||||||
|
|
||||||
def _read_conf_file(path):
|
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:
|
with salt.utils.fopen(path, 'r') as conf_file:
|
||||||
conf_opts = yaml.safe_load(conf_file.read()) or {}
|
conf_opts = yaml.safe_load(conf_file.read()) or {}
|
||||||
# allow using numeric ids: convert int to string
|
# 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:
|
if len(opts['sock_dir']) > len(opts['cachedir']) + 10:
|
||||||
opts['sock_dir'] = os.path.join(opts['cachedir'], '.salt-unix')
|
opts['sock_dir'] = os.path.join(opts['cachedir'], '.salt-unix')
|
||||||
|
|
||||||
import salt.crypt
|
|
||||||
opts['aes'] = salt.crypt.Crypticle.generate_key_string()
|
opts['aes'] = salt.crypt.Crypticle.generate_key_string()
|
||||||
|
|
||||||
opts['extension_modules'] = (
|
opts['extension_modules'] = (
|
||||||
|
@ -30,6 +30,8 @@ except ImportError:
|
|||||||
HAS_FNCTL = False
|
HAS_FNCTL = False
|
||||||
|
|
||||||
# Import salt libs
|
# Import salt libs
|
||||||
|
import salt.minion
|
||||||
|
import salt.payload
|
||||||
from salt.exceptions import SaltClientError, CommandNotFoundError
|
from salt.exceptions import SaltClientError, CommandNotFoundError
|
||||||
|
|
||||||
|
|
||||||
@ -195,8 +197,6 @@ def daemonize_if(opts, **kwargs):
|
|||||||
if not 'jid' in data:
|
if not 'jid' in data:
|
||||||
return
|
return
|
||||||
|
|
||||||
import salt.minion
|
|
||||||
import salt.payload
|
|
||||||
serial = salt.payload.Serial(opts)
|
serial = salt.payload.Serial(opts)
|
||||||
proc_dir = salt.minion.get_proc_dir(opts['cachedir'])
|
proc_dir = salt.minion.get_proc_dir(opts['cachedir'])
|
||||||
fn_ = os.path.join(proc_dir, data['jid'])
|
fn_ = os.path.join(proc_dir, data['jid'])
|
||||||
|
@ -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
|
If we can get a version from Git use that instead, otherwise we carry on
|
||||||
'''
|
'''
|
||||||
try:
|
try:
|
||||||
from salt.utils import which
|
process = subprocess.Popen(
|
||||||
|
'which git',
|
||||||
git = which('git')
|
stdout=subprocess.PIPE,
|
||||||
if not git:
|
shell=True
|
||||||
|
)
|
||||||
|
git, _ = process.communicate()
|
||||||
|
if process.poll() != 0:
|
||||||
return version, version_info
|
return version, version_info
|
||||||
|
git = git[:-1]
|
||||||
|
|
||||||
process = subprocess.Popen(
|
process = subprocess.Popen(
|
||||||
[git, 'describe'],
|
[git, 'describe'],
|
||||||
|
Loading…
Reference in New Issue
Block a user