diff options
author | Matt Martz <matt@sivel.net> | 2021-05-25 10:03:55 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-25 11:03:55 -0400 |
commit | 4a4ffbadc5d1b5d7ef7c1323ff8756c40af331de (patch) | |
tree | 6f41ae004d8713164c77598a3316fff3f7cf1196 /lib/ansible/playbook/play_context.py | |
parent | 63701b1b6b18a0d396c8b96debebf4de1cd20098 (diff) | |
download | ansible-4a4ffbadc5d1b5d7ef7c1323ff8756c40af331de.tar.gz |
Remove deprecated PlayContext.make_become_cmd (#74790)
Diffstat (limited to 'lib/ansible/playbook/play_context.py')
-rw-r--r-- | lib/ansible/playbook/play_context.py | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/lib/ansible/playbook/play_context.py b/lib/ansible/playbook/play_context.py index c328a8c0fa..9058792f45 100644 --- a/lib/ansible/playbook/play_context.py +++ b/lib/ansible/playbook/play_context.py @@ -320,43 +320,6 @@ class PlayContext(Base): def set_become_plugin(self, plugin): self._become_plugin = plugin - def make_become_cmd(self, cmd, executable=None): - """ helper function to create privilege escalation commands """ - display.deprecated( - "PlayContext.make_become_cmd should not be used, the calling code should be using become plugins instead", - version="2.12", collection_name='ansible.builtin' - ) - - if not cmd or not self.become: - return cmd - - become_method = self.become_method - - # load/call become plugins here - plugin = self._become_plugin - - if plugin: - options = { - 'become_exe': self.become_exe or become_method, - 'become_flags': self.become_flags or '', - 'become_user': self.become_user, - 'become_pass': self.become_pass - } - plugin.set_options(direct=options) - - if not executable: - executable = self.executable - - shell = get_shell_plugin(executable=executable) - cmd = plugin.build_become_command(cmd, shell) - # for backwards compat: - if self.become_pass: - self.prompt = plugin.prompt - else: - raise AnsibleError("Privilege escalation method not found: %s" % become_method) - - return cmd - def update_vars(self, variables): ''' Adds 'magic' variables relating to connections to the variable dictionary provided. |