Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import absolute_import
import os
import sys
import pykwalify
import yaml
from pykwalify.core import Core as PyKwalify
from . import default
pykwalify.init_logging(1)
DEFAULT_CONFIG_FILE = "/opt/xos/xos_config.yaml"
DEFAULT_CONFIG_SCHEMA = "xos-config-schema.yaml"
INITIALIZED = False
CONFIG_FILE = None
CONFIG = {}
OVERRIDE_CONFIG = {}
class Config:
"""
XOS Configuration APIs
"""
@staticmethod
--allow-assertions By default assertions is disabled due to security risk.
Error will be raised if assertion is used in schema
but this flag is not used. This option enables assert keyword.
--encoding ENCODING Specify encoding to open data and schema files with.
-h, --help show this help message and exit
-q, --quiet suppress terminal output
-v, --verbose verbose terminal output (multiple -v increases verbosity)
--version display the version number and exit
"""
# Import pykwalify package
import pykwalify
args = docopt(__docopt__, version=pykwalify.__version__)
pykwalify.init_logging(1 if args["--quiet"] else args["--verbose"])
log = logging.getLogger(__name__)
#
# 2. validate arguments only, dont go into other code/logic
#
log.debug("Setting verbose level: %s", args["--verbose"])
log.debug("Arguments from CLI: %s", args)
return args