예제 #1
0
파일: init.py 프로젝트: sebinjohn/molecule
#  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.
예제 #2
0
파일: login.py 프로젝트: robtec/molecule
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: