Set up functions that are safe to execute when commands sent to the master without encryption and authentication
| 3713 | |
| 3714 | |
| 3715 | class ClearFuncs(TransportMethods): |
| 3716 | """ |
| 3717 | Set up functions that are safe to execute when commands sent to the master |
| 3718 | without encryption and authentication |
| 3719 | """ |
| 3720 | |
| 3721 | # These methods will be exposed to the transport layer by |
| 3722 | # MWorker._handle_clear |
| 3723 | expose_methods = ( |
| 3724 | "ping", |
| 3725 | "publish", |
| 3726 | "get_token", |
| 3727 | "mk_token", |
| 3728 | "wheel", |
| 3729 | "runner", |
| 3730 | ) |
| 3731 | async_methods = ("publish",) |
| 3732 | |
| 3733 | # The ClearFuncs object encapsulates the functions that can be executed in |
| 3734 | # the clear: |
| 3735 | # publish (The publish from the LocalClient) |
| 3736 | # _auth |
| 3737 | def __init__(self, opts, key): |
| 3738 | self.opts = opts |
| 3739 | self.key = key |
| 3740 | self.event = None |
| 3741 | self.local = None |
| 3742 | self.ckminions = None |
| 3743 | self.loadauth = None |
| 3744 | self.mminion = None |
| 3745 | self.masterapi = None |
| 3746 | # Create the event manager |
| 3747 | self.event = salt.utils.event.get_master_event( |
| 3748 | self.opts, self.opts["sock_dir"], listen=False |
| 3749 | ) |
| 3750 | # Make a client |
| 3751 | self.local = salt.client.get_local_client(self.opts["conf_file"]) |
| 3752 | # Make an minion checker object |
| 3753 | self.ckminions = salt.utils.minions.CkMinions(opts) |
| 3754 | # Make an Auth object |
| 3755 | self.loadauth = salt.auth.LoadAuth(opts) |
| 3756 | # Stand up the master Minion to access returner data |
| 3757 | self.mminion = salt.minion.MasterMinion( |
| 3758 | self.opts, states=False, rend=False, ignore_config_errors=True |
| 3759 | ) |
| 3760 | # Make a wheel object |
| 3761 | self.wheel_ = salt.wheel.Wheel(opts) |
| 3762 | # Make a masterapi object |
| 3763 | self.masterapi = salt.daemons.masterapi.LocalFuncs(opts, key) |
| 3764 | self.channels = [] |
| 3765 | |
| 3766 | def runner(self, clear_load): |
| 3767 | """ |
| 3768 | Send a master control function back to the runner system |
| 3769 | """ |
| 3770 | # All runner ops pass through eauth |
| 3771 | auth_type, err_name, key, sensitive_load_keys = self._prep_auth_info(clear_load) |
| 3772 |