Execute the CLI options to fill in the extra data needed for the defined eauth system
(self, eauth)
| 742 | return channel.send(load) |
| 743 | |
| 744 | def cli(self, eauth): |
| 745 | """ |
| 746 | Execute the CLI options to fill in the extra data needed for the |
| 747 | defined eauth system |
| 748 | """ |
| 749 | ret = {} |
| 750 | if not eauth: |
| 751 | print("External authentication system has not been specified") |
| 752 | return ret |
| 753 | fstr = f"{eauth}.auth" |
| 754 | if fstr not in self.auth: |
| 755 | print( |
| 756 | 'The specified external authentication system "{}" is not available'.format( |
| 757 | eauth |
| 758 | ) |
| 759 | ) |
| 760 | print( |
| 761 | "Available eauth types: {}".format( |
| 762 | ", ".join(sorted(k[:-5] for k in self.auth if k.endswith(".auth"))) |
| 763 | ) |
| 764 | ) |
| 765 | return ret |
| 766 | |
| 767 | args = salt.utils.args.arg_lookup(self.auth[fstr]) |
| 768 | for arg in args["args"]: |
| 769 | if arg in self.opts: |
| 770 | ret[arg] = self.opts[arg] |
| 771 | elif arg.startswith("pass"): |
| 772 | ret[arg] = getpass.getpass(f"{arg}: ") |
| 773 | else: |
| 774 | ret[arg] = input(f"{arg}: ") |
| 775 | for kwarg, default in list(args["kwargs"].items()): |
| 776 | if kwarg in self.opts: |
| 777 | ret["kwarg"] = self.opts[kwarg] |
| 778 | else: |
| 779 | ret[kwarg] = input(f"{kwarg} [{default}]: ") |
| 780 | |
| 781 | # Use current user if empty |
| 782 | if "username" in ret and not ret["username"]: |
| 783 | ret["username"] = salt.utils.user.get_user() |
| 784 | |
| 785 | return ret |
| 786 | |
| 787 | def token_cli(self, eauth, load): |
| 788 | """ |