Best Python code snippet using molecule_python
ansible_playbooks.py
Source:ansible_playbooks.py  
...71            except Exception:72                pass73        if playbook is not None:74            playbook = self._config.provisioner.abs_path(playbook)75            playbook = self._normalize_playbook(playbook)76            if os.path.exists(playbook):77                return playbook78            elif os.path.exists(self._get_bundled_driver_playbook(section)):79                return self._get_bundled_driver_playbook(section)80            elif section not in [81                # these playbooks can be considered optional82                "prepare",83                "create",84                "destroy",85                "cleanup",86                "side_effect",87                "verify",88            ]:89                return playbook90    def _get_bundled_driver_playbook(self, section):91        return self._config.driver.get_playbook(section) or os.path.join(92            self._get_playbook_directory(),93            self._config.driver.name,94            self._config.config["provisioner"]["playbooks"][section],95        )96    def _normalize_playbook(self, playbook):97        """98        Return current filename to use for a playook by allowing fallbacks.99        Currently used to deprecate use of playbook.yml in favour of converge.yml100        """101        # TODO(ssbarnea): Remove that deprecation fallback in 3.1+102        if not playbook or os.path.isfile(playbook):103            return playbook104        pb_rename_map = {"converge.yml": "playbook.yml"}105        basename = os.path.basename(playbook)106        if basename in pb_rename_map:107            fb_playbook = os.path.join(108                os.path.dirname(playbook), pb_rename_map[basename]109            )110            if os.path.isfile(fb_playbook):...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
