"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "salt/netapi/__init__.py" between
salt-3002.1.tar.gz and salt-3002.2.tar.gz

About: SaltStack is a systems management software for data center automation, cloud orchestration, server provisioning, configuration management and more. Community version.

__init__.py  (salt-3002.1):__init__.py  (salt-3002.2)
# encoding: utf-8
""" """
Make api awesomeness Make api awesomeness
""" """
from __future__ import absolute_import, print_function, unicode_literals
import copy import copy
# Import Python libs
import inspect import inspect
import logging import logging
import os import os
import salt.auth import salt.auth
import salt.client import salt.client
import salt.client.ssh.client import salt.client.ssh.client
import salt.config import salt.config
import salt.daemons.masterapi import salt.daemons.masterapi
import salt.exceptions import salt.exceptions
# Import Salt libs
import salt.log # pylint: disable=W0611 import salt.log # pylint: disable=W0611
import salt.runner import salt.runner
import salt.syspaths import salt.syspaths
import salt.utils.args import salt.utils.args
import salt.utils.minions import salt.utils.minions
import salt.wheel import salt.wheel
from salt.defaults import DEFAULT_TARGET_DELIM from salt.defaults import DEFAULT_TARGET_DELIM
# Import third party libs
from salt.ext import six from salt.ext import six
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class NetapiClient(object): class NetapiClient:
""" """
Provide a uniform method of accessing the various client interfaces in Salt Provide a uniform method of accessing the various client interfaces in Salt
in the form of low-data data structures. For example: in the form of low-data data structures. For example:
>>> client = NetapiClient(__opts__) >>> client = NetapiClient(__opts__)
>>> lowstate = {'client': 'local', 'tgt': '*', 'fun': 'test.ping', 'arg': '' } >>> lowstate = {'client': 'local', 'tgt': '*', 'fun': 'test.ping', 'arg': '' }
>>> client.run(lowstate) >>> client.run(lowstate)
""" """
def __init__(self, opts): def __init__(self, opts):
skipping to change at line 131 skipping to change at line 123
lowstate lowstate
""" """
# Eauth currently requires a running daemon and commands run through # Eauth currently requires a running daemon and commands run through
# this method require eauth so perform a quick check to raise a # this method require eauth so perform a quick check to raise a
# more meaningful error. # more meaningful error.
if not self._is_master_running(): if not self._is_master_running():
raise salt.exceptions.SaltDaemonNotRunning("Salt Master is not avail able.") raise salt.exceptions.SaltDaemonNotRunning("Salt Master is not avail able.")
if low.get("client") not in CLIENTS: if low.get("client") not in CLIENTS:
raise salt.exceptions.SaltInvocationError( raise salt.exceptions.SaltInvocationError(
"Invalid client specified: '{0}'".format(low.get("client")) "Invalid client specified: '{}'".format(low.get("client"))
) )
if not ("token" in low or "eauth" in low): if not ("token" in low or "eauth" in low):
raise salt.exceptions.EauthAuthenticationError( raise salt.exceptions.EauthAuthenticationError(
"No authentication credentials given" "No authentication credentials given"
) )
if low.get("raw_shell") and not self.opts.get("netapi_allow_raw_shell"): if low.get("raw_shell") and not self.opts.get("netapi_allow_raw_shell"):
raise salt.exceptions.EauthAuthenticationError( raise salt.exceptions.EauthAuthenticationError(
"Raw shell option not allowed." "Raw shell option not allowed."
 End of changes. 7 change blocks. 
10 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)