# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # DEALINGS IN THE SOFTWARE. import os import click from molecule import util from molecule.command import base LOG = util.get_logger(__name__) class Init(base.Base): def main(self): """ Overriden to prevent the initialization of a molecule object, since :class:`.Config` cannot parse a non-existent `molecule.yml`. :returns: None """ pass def execute(self, exit=True): """ Execute the actions necessary to perform a `molecule init` and exit.
import fcntl import os import pexpect import signal import struct import subprocess import sys import termios import click from molecule import util from molecule.command import base LOG = util.get_logger(__name__) class Login(base.Base): def execute(self, exit=True): """ Execute the actions necessary to perform a `molecule login` and return a tuple. :param exit: (Unused) Provided to complete method signature. :return: Return a tuple of None, otherwise sys.exit on command failure. """ # get list of running hosts from state if self.molecule.state.hosts: hosts = [k for k, v in self.molecule.state.hosts.iteritems()] else: