예제 #1
0
    def run(self):
        '''
        Execute the salt call!
        '''
        self.parse_args()

        if self.options.file_root:
            # check if the argument is pointing to a file on disk
            file_root = os.path.abspath(self.options.file_root)
            self.config['file_roots'] = {'base': _expand_glob_path([file_root])}

        if self.options.pillar_root:
            # check if the argument is pointing to a file on disk
            pillar_root = os.path.abspath(self.options.pillar_root)
            self.config['pillar_roots'] = {'base': _expand_glob_path([pillar_root])}

        if self.options.local:
            self.config['file_client'] = 'local'
        if self.options.master:
            self.config['master'] = self.options.master

        # Setup file logging!
        self.setup_logfile_logger()

        caller = salt.cli.caller.Caller.factory(self.config)

        if self.options.doc:
            caller.print_docs()
            self.exit(os.EX_OK)

        if self.options.grains_run:
            caller.print_grains()
            self.exit(os.EX_OK)

        caller.run()
예제 #2
0
파일: __init__.py 프로젝트: rizumu/salt
    def run(self):
        """
        Execute the salt call!
        """
        self.parse_args()

        if self.config["verify_env"]:
            verify_env(
                [self.config["pki_dir"], self.config["cachedir"], os.path.dirname(self.config["log_file"])],
                self.config["user"],
                permissive=self.config["permissive_pki_access"],
                pki_dir=self.config["pki_dir"],
            )

        if self.options.local:
            self.config["file_client"] = "local"

        # Setup file logging!
        self.setup_logfile_logger()

        caller = salt.cli.caller.Caller(self.config)

        if self.options.doc:
            caller.print_docs()
            self.exit(0)

        if self.options.grains_run:
            caller.print_grains()
            self.exit(0)

        caller.run()
예제 #3
0
    def run(self):
        '''
        Execute the salt call!
        '''
        self.parse_args()

        if self.config['verify_env']:
            verify_env([
                    self.config['pki_dir'],
                    self.config['cachedir'],
                    os.path.dirname(self.config['log_file'])
                ],
                self.config['user'],
                permissive=self.config['permissive_pki_access'],
                pki_dir=self.config['pki_dir'],
            )

        caller = salt.cli.caller.Caller(self.config)

        if self.options.doc:
            caller.print_docs()
            self.exit(0)

        if self.options.grains_run:
            caller.print_grains()
            self.exit(0)

        caller.run()
예제 #4
0
파일: __init__.py 프로젝트: studer/salt
 def run(self):
     '''
     Execute the salt call!
     '''
     import salt.log
     salt.log.setup_console_logger(self.opts['log_level'])
     import logging
     caller = salt.cli.caller.Caller(self.opts)
     caller.run()
예제 #5
0
    def run(self):
        """
        Execute the salt call!
        """
        import salt.log

        salt.log.setup_console_logger(self.opts["log_level"])
        caller = salt.cli.caller.Caller(self.opts)
        caller.run()
예제 #6
0
파일: __init__.py 프로젝트: Adapptor/salt
 def run(self):
     '''
     Execute the salt call!
     '''
     import salt.log
     salt.log.setup_console_logger(
         self.opts['log_level']
     )
     caller = salt.cli.caller.Caller(self.opts)
     caller.run()
예제 #7
0
    def run(self):
        '''
        Execute the salt call!
        '''
        self.parse_args()

        if self.config['verify_env']:
            verify_env([
                    self.config['pki_dir'],
                    self.config['cachedir'],
                ],
                self.config['user'],
                permissive=self.config['permissive_pki_access'],
                pki_dir=self.config['pki_dir'],
            )
            if not self.config['log_file'].startswith(('tcp://',
                                                       'udp://',
                                                       'file://')):
                # Logfile is not using Syslog, verify
                verify_files(
                    [self.config['log_file']],
                    self.config['user']
                )

        if self.options.file_root:
            # check if the argument is pointing to a file on disk
            file_root = os.path.abspath(self.options.file_root)
            self.config['file_roots'] = {'base': [file_root]}

        if self.options.pillar_root:
            # check if the argument is pointing to a file on disk
            pillar_root = os.path.abspath(self.options.pillar_root)
            self.config['pillar_roots'] = {'base': [pillar_root]}

        if self.options.local:
            self.config['file_client'] = 'local'
        if self.options.master:
            self.config['master'] = self.options.master

        # Setup file logging!
        self.setup_logfile_logger()

        #caller = salt.cli.caller.Caller(self.config)
        caller = salt.cli.caller.Caller.factory(self.config)

        if self.options.doc:
            caller.print_docs()
            self.exit(salt.exitcodes.EX_OK)

        if self.options.grains_run:
            caller.print_grains()
            self.exit(salt.exitcodes.EX_OK)

        caller.run()
예제 #8
0
파일: __init__.py 프로젝트: timofei7/salt
 def run(self):
     '''
     Execute the salt call!
     '''
     import salt.log
     salt.log.setup_console_logger(
         self.opts['log_level'],
         log_format=self.opts['log_fmt_console'],
         date_format=self.opts['log_datefmt'],
     )
     caller = salt.cli.caller.Caller(self.opts)
     caller.run()
예제 #9
0
 def run(self):
     '''
     Execute the salt call!
     '''
     import salt.log
     salt.log.setup_console_logger(
         self.opts['log_level'],
         log_format=self.opts['log_fmt_console'],
         date_format=self.opts['log_datefmt'],
     )
     caller = salt.cli.caller.Caller(self.opts)
     caller.run()
예제 #10
0
파일: __init__.py 프로젝트: 1mentat/salt
    def run(self):
        '''
        Execute the salt call!
        '''
        self.parse_args()

        if self.config['verify_env']:
            verify_env([
                    self.config['pki_dir'],
                    self.config['cachedir'],
                ],
                self.config['user'],
                permissive=self.config['permissive_pki_access'],
                pki_dir=self.config['pki_dir'],
            )
            if not self.config['log_file'].startswith(('tcp://',
                                                       'udp://',
                                                       'file://')):
                # Logfile is not using Syslog, verify
                verify_files(
                    [self.config['log_file']],
                    self.config['user']
                )

        if self.options.file_root:
            # check if the argument is pointing to a file on disk
            file_root = os.path.abspath(self.options.file_root)
            self.config['file_roots'] = {'base':  [file_root]}

        if self.options.pillar_root:
            # check if the argument is pointing to a file on disk
            pillar_root = os.path.abspath(self.options.pillar_root)
            self.config['pillar_roots'] = {'base':  [pillar_root]}

        if self.options.local:
            self.config['file_client'] = 'local'
        if self.options.master:
            self.config['master'] = self.options.master

        # Setup file logging!
        self.setup_logfile_logger()

        caller = salt.cli.caller.Caller(self.config)

        if self.options.doc:
            caller.print_docs()
            self.exit(0)

        if self.options.grains_run:
            caller.print_grains()
            self.exit(0)

        caller.run()
예제 #11
0
    def run(self):
        """
        Execute the salt call!
        """
        self.parse_args()

        if self.config["verify_env"]:
            verify_env(
                [self.config["pki_dir"], self.config["cachedir"]],
                self.config["user"],
                permissive=self.config["permissive_pki_access"],
                pki_dir=self.config["pki_dir"],
            )
            if not self.config["log_file"].startswith(("tcp://", "udp://", "file://")):
                # Logfile is not using Syslog, verify
                verify_files([self.config["log_file"]], self.config["user"])

        if self.options.file_root:
            # check if the argument is pointing to a file on disk
            file_root = os.path.abspath(self.options.file_root)
            self.config["file_roots"] = {"base": [file_root]}

        if self.options.pillar_root:
            # check if the argument is pointing to a file on disk
            pillar_root = os.path.abspath(self.options.pillar_root)
            self.config["pillar_roots"] = {"base": [pillar_root]}

        if self.options.local:
            self.config["file_client"] = "local"
        if self.options.master:
            self.config["master"] = self.options.master

        # Setup file logging!
        self.setup_logfile_logger()

        # caller = salt.cli.caller.Caller(self.config)
        caller = salt.cli.caller.Caller.factory(self.config)

        if self.options.doc:
            caller.print_docs()
            self.exit(salt.exitcodes.EX_OK)

        if self.options.grains_run:
            caller.print_grains()
            self.exit(salt.exitcodes.EX_OK)

        caller.run()
예제 #12
0
    def run(self):
        """
        Execute the salt call!
        """
        self.parse_args()

        if self.options.file_root:
            # check if the argument is pointing to a file on disk
            file_root = os.path.abspath(self.options.file_root)
            self.config["file_roots"] = {
                "base": _expand_glob_path([file_root])
            }

        if self.options.pillar_root:
            # check if the argument is pointing to a file on disk
            pillar_root = os.path.abspath(self.options.pillar_root)
            self.config["pillar_roots"] = {
                "base": _expand_glob_path([pillar_root])
            }

        if self.options.states_dir:
            # check if the argument is pointing to a file on disk
            states_dir = os.path.abspath(self.options.states_dir)
            self.config["states_dirs"] = [states_dir]

        if self.options.local:
            self.config["file_client"] = "local"
        if self.options.master:
            self.config["master"] = self.options.master

        # Setup file logging!
        self.setup_logfile_logger()
        verify_log(self.config)

        caller = salt.cli.caller.Caller.factory(self.config)

        if self.options.doc:
            caller.print_docs()
            self.exit(salt.defaults.exitcodes.EX_OK)

        if self.options.grains_run:
            caller.print_grains()
            self.exit(salt.defaults.exitcodes.EX_OK)

        caller.run()
예제 #13
0
    def run(self):
        '''
        Execute the salt call!
        '''
        self.parse_args()

        if self.config['verify_env']:
            verify_env([
                    self.config['pki_dir'],
                    self.config['cachedir'],
                ],
                self.config['user'],
                permissive=self.config['permissive_pki_access'],
                pki_dir=self.config['pki_dir'],
            )
            if (not self.config['log_file'].startswith('tcp://') or
                    not self.config['log_file'].startswith('udp://') or
                    not self.config['log_file'].startswith('file://')):
                # Logfile is not using Syslog, verify
                verify_files(
                    [self.config['log_file']],
                    self.config['user']
                )

        if self.options.local:
            self.config['file_client'] = 'local'
        if self.options.master:
            self.config['master'] = self.options.master

        # Setup file logging!
        self.setup_logfile_logger()

        caller = salt.cli.caller.Caller(self.config)

        if self.options.doc:
            caller.print_docs()
            self.exit(0)

        if self.options.grains_run:
            caller.print_grains()
            self.exit(0)

        caller.run()
예제 #14
0
파일: call.py 프로젝트: bryson/salt
    def run(self):
        """
        Execute the salt call!
        """
        self.parse_args()

        if self.options.file_root:
            # check if the argument is pointing to a file on disk
            file_root = os.path.abspath(self.options.file_root)
            self.config["file_roots"] = {"base": _expand_glob_path([file_root])}

        if self.options.pillar_root:
            # check if the argument is pointing to a file on disk
            pillar_root = os.path.abspath(self.options.pillar_root)
            self.config["pillar_roots"] = {"base": _expand_glob_path([pillar_root])}

        if self.options.states_dir:
            # check if the argument is pointing to a file on disk
            states_dir = os.path.abspath(self.options.states_dir)
            self.config["states_dirs"] = [states_dir]

        if self.options.local:
            self.config["file_client"] = "local"
        if self.options.master:
            self.config["master"] = self.options.master

        # Setup file logging!
        self.setup_logfile_logger()
        verify_log(self.config)

        caller = salt.cli.caller.Caller.factory(self.config)

        if self.options.doc:
            caller.print_docs()
            self.exit(salt.defaults.exitcodes.EX_OK)

        if self.options.grains_run:
            caller.print_grains()
            self.exit(salt.defaults.exitcodes.EX_OK)

        caller.run()
예제 #15
0
    def run(self):
        '''
        Execute a lightweight salt-call with bespoken options.
        '''
        self.parse_args()

        if self.options.file_root:
            # check if the argument is pointing to a file on disk
            file_root = os.path.abspath(self.options.file_root)
            self.config['file_roots'] = {
                'base': _expand_glob_path([file_root])
            }

        if self.options.pillar_root:
            # check if the argument is pointing to a file on disk
            pillar_root = os.path.abspath(self.options.pillar_root)
            self.config['pillar_roots'] = {
                'base': _expand_glob_path([pillar_root])
            }

        # Always local client
        self.config['file_client'] = 'local'
        self.config['transport'] = 'tcp'

        if not self.config.get('confdir'):
            self.config['confdir'] = self.config['config_dir']

        confd_dir = os.path.join(self.config['confdir'], 'conf.d')
        templates_dir = os.path.join(self.config['confdir'], 'templates')

        self.config['file_roots']['base'].append(os.path.dirname(__file__))
        self.config['file_roots']['base'].append(templates_dir)

        # Setup file logging!
        self.setup_logfile_logger()
        verify_log(self.config)

        self.config['fun'] = 'state.apply'
        self.config['arg'] = ['confd']
        self.config['confd'] = {}

        minion_mods = salt.loader.minion_mods(self.config)
        renderers = salt.loader.render(self.config, minion_mods)

        kwargs = {}
        path_or_string = ':string:'
        rgx = re.compile(r'^(.*):\/\/(.*)$')

        for file_ in os.listdir(confd_dir):
            confd_file = os.path.join(confd_dir, file_)
            if not os.path.isfile(confd_file):
                continue
            with salt.utils.files.fopen(confd_file, 'r') as fp_:
                string = fp_.read()
                kwargs['input_data'] = string
                ret = salt.template.compile_template(
                    path_or_string, renderers,
                    self.config.get('default_renderer', 'jinja|yaml'),
                    self.config.get('renderer_blacklist'),
                    self.config.get('renderer_whitelist'), **kwargs)
                res = ret.read() if salt.utils.stringio.is_readable(
                    ret) else ret
                for dest, opts in res.items():
                    if not rgx.match(opts['src']):
                        opts['src'] = 'salt://' + opts['src']
                    if not opts.get('template'):
                        opts['template'] = 'jinja'
                    self.config['confd'][dest] = opts

        caller = salt.cli.caller.Caller.factory(self.config)
        caller.run()
예제 #16
0
파일: __init__.py 프로젝트: geekbuntu/salt
 def run(self):
     """
     Execute the salt call!
     """
     caller = salt.cli.caller.Caller(self.opts)
     caller.run()
예제 #17
0
파일: __init__.py 프로젝트: mineo/salt
 def run(self):
     '''
     Execute the salt call!
     '''
     caller = salt.cli.caller.Caller(self.opts)
     caller.run()
예제 #18
0
 def run(self):
     '''
     Execute the salt call!
     '''
     caller = salt.cli.caller.Caller(self.opts)
     caller.run()