mirror of
https://github.com/valitydev/salt.git
synced 2024-11-09 01:36:48 +00:00
Remove try/except blocks for imports that will always exist
This commit is contained in:
parent
fec7703ef3
commit
576db03638
@ -58,11 +58,9 @@ __opts__ = {
|
||||
}
|
||||
|
||||
# Import libraries
|
||||
try:
|
||||
import yaml
|
||||
HAS_YAML = True
|
||||
except ImportError:
|
||||
HAS_YAML = False
|
||||
import yaml
|
||||
import jinja2
|
||||
import re
|
||||
|
||||
try:
|
||||
from os.path import isfile, join
|
||||
@ -70,37 +68,13 @@ try:
|
||||
except ImportError:
|
||||
HAS_OS_PATH = False
|
||||
|
||||
try:
|
||||
import re
|
||||
HAS_RE = True
|
||||
except ImportError:
|
||||
HAS_RE = False
|
||||
|
||||
try:
|
||||
import jinja2
|
||||
HAS_JINJA2 = True
|
||||
except ImportError:
|
||||
HAS_JINJA2 = False
|
||||
|
||||
|
||||
def __virtual__():
|
||||
'''
|
||||
Only return if all the modules are available
|
||||
'''
|
||||
if not HAS_YAML:
|
||||
log.error('Failed to load "yaml" library')
|
||||
return False
|
||||
|
||||
if not HAS_OS_PATH:
|
||||
log.error('Failed to load "os.path" library')
|
||||
return False
|
||||
|
||||
if not HAS_RE:
|
||||
log.error('Failed to load "re" library')
|
||||
return False
|
||||
|
||||
if not HAS_JINJA2:
|
||||
log.error('Failed to load "jinja2" library')
|
||||
return False
|
||||
|
||||
return True
|
||||
|
Loading…
Reference in New Issue
Block a user