예제 #1
0
    except socket.error:
        return False
    # docker-proxy opens the port immediately after container is started.
    # Receive data from the socket to check if VNC session is really running.
    if not soc.recv(1024):
        return False
    soc.close()
    return True


@click.command(help='Starts selenium container for testing against')
@click.option('--watch', help='Opens VNC session', default=False, is_flag=True)
@click.option('--vnc', help='Chooses VNC port', default=5900)
@click.option('--webdriver', help='Chooses webdriver port', default=4444)
@click.option('--image', help='Chooses selenium container image',
              default=docker_conf.get('selff', 'cfmeqe/sel_ff_chrome'))
@click.option('--vncviewer', help='Chooses VNC viewer command',
              default=docker_conf.get('vncviewer', 'vinagre'))
@click.option('--random-ports', is_flag=True, default=False,
              help='Choose random ports for VNC, webdriver, (overrides --webdriver and --vnc)')
def main(watch, vnc, webdriver, image, vncviewer, random_ports):
    """Main function for running"""

    ip = '127.0.0.1'

    print("Starting container...")
    vnc = random_port() if random_ports else vnc
    webdriver = random_port() if random_ports else webdriver

    dkb = SeleniumDocker(bindings={'VNC_PORT': (5999, vnc),
                                   'WEBDRIVER': (4444, webdriver)},
예제 #2
0
    parser = argparse.ArgumentParser(argument_default=None)

    interaction = parser.add_argument_group('Ports')
    interaction.add_argument('--watch',
                             help='Opens vnc session',
                             action="store_true",
                             default=False)
    interaction.add_argument('--vnc',
                             help='Chooses VNC port',
                             default=random_port())
    interaction.add_argument('--webdriver',
                             help='Choose WebDriver port',
                             default=random_port())
    interaction.add_argument('--image',
                             help='Choose WebDriver port',
                             default=docker_conf.get('selff',
                                                     'cfme/sel_ff_chrome'))

    args = parser.parse_args()

    print("Starting container...")

    dkb = SeleniumDocker(bindings={
        'VNC_PORT': (5999, args.vnc),
        'WEBDRIVER': (4444, args.webdriver)
    },
                         image=args.image)
    dkb.run()

    if args.watch:
        print
        print("  Waiting for container for 10 seconds...")
예제 #3
0
import json
import requests
from utils.conf import docker as docker_conf
from utils.appliance import Appliance
from utils.trackerbot import api
from utils.log import create_logger
from slumber.exceptions import HttpClientError

token = docker_conf['gh_token']
owner = docker_conf['gh_owner']
repo = docker_conf['gh_repo']

tapi = api()

CONT_LIMIT = docker_conf['workers']
DEBUG = docker_conf.get('debug', False)

logger = create_logger('check_prs', 'prt.log')


def perform_request(url):
    """ Simple function to assist in performing GET requests from github

    Runs if there is a token, else just spits out a blank dict

    Args:
        url: The url to process, which is anything after the "...repos/"

    """
    out = {}
    if token:
예제 #4
0
import json
import requests
from utils.conf import docker as docker_conf
from utils.appliance import Appliance
from utils.trackerbot import api
from utils.log import create_logger
from slumber.exceptions import HttpClientError

token = docker_conf['gh_token']
owner = docker_conf['gh_owner']
repo = docker_conf['gh_repo']

tapi = api()

CONT_LIMIT = docker_conf['workers']
DEBUG = docker_conf.get('debug', False)

logger = create_logger('check_prs', 'prt.log')


def perform_request(url):
    """ Simple function to assist in performing GET requests from github

    Runs if there is a token, else just spits out a blank dict

    Args:
        url: The url to process, which is anything after the "...repos/"

    """
    out = {}
    if token:
예제 #5
0
 def check_arg(self, name, default):
     self.args[name] = self.args.get(name)
     if not self.args[name]:
         self.args[name] = docker_conf.get(name, default)
예제 #6
0
    soc.close()
    return True


if __name__ == "__main__":
    parser = argparse.ArgumentParser(argument_default=None)

    interaction = parser.add_argument_group('Ports')
    interaction.add_argument('--watch', help='Opens VNC session',
                             action='store_true', default=False)
    interaction.add_argument('--vnc', help='Chooses VNC port',
                             default=random_port())
    interaction.add_argument('--webdriver', help='Chooses WebDriver port',
                             default=random_port())
    interaction.add_argument('--image', help='Chooses WebDriver port',
                             default=docker_conf.get('selff', 'cfme/sel_ff_chrome'))
    interaction.add_argument('--vncviewer', help='Chooses VNC viewer command',
                             default=docker_conf.get('vncviewer', None))

    args = parser.parse_args()
    ip = '127.0.0.1'

    print("Starting container...")

    dkb = SeleniumDocker(bindings={'VNC_PORT': (5999, args.vnc),
                                   'WEBDRIVER': (4444, args.webdriver)},
                         image=args.image)
    dkb.run()

    if args.watch:
        print
예제 #7
0
 def check_arg(self, name, default):
     self.args[name] = self.args.get(name)
     if not self.args[name]:
         self.args[name] = docker_conf.get(name, default)
예제 #8
0
from dockerbot import SeleniumDocker
from utils.net import random_port, net_check
from utils.conf import docker as docker_conf

if __name__ == "__main__":
    parser = argparse.ArgumentParser(argument_default=None)

    interaction = parser.add_argument_group('Ports')
    interaction.add_argument('--watch', help='Opens vnc session',
                             action="store_true", default=False)
    interaction.add_argument('--vnc', help='Chooses VNC port',
                             default=random_port())
    interaction.add_argument('--webdriver', help='Choose WebDriver port',
                             default=random_port())
    interaction.add_argument('--image', help='Choose WebDriver port',
                             default=docker_conf.get('selff', 'cfme/sel_ff_chrome'))

    args = parser.parse_args()

    print("Starting container...")

    dkb = SeleniumDocker(bindings={'VNC_PORT': (5999, args.vnc),
                                   'WEBDRIVER': (4444, args.webdriver)},
                         image=args.image)
    dkb.run()

    if args.watch:
        print
        print("  Waiting for VNC port to open...")
        wait_for(lambda: net_check(args.vnc, '127.0.0.1'), num_sec=60)
        time.sleep(10)
예제 #9
0
import logging
from utils.conf import docker as docker_conf
from utils.appliance import Appliance
from utils.trackerbot import api
from utils.log import create_logger
from slumber.exceptions import HttpClientError


token = docker_conf["gh_token"]
owner = docker_conf["gh_owner"]
repo = docker_conf["gh_repo"]

tapi = api()

CONT_LIMIT = docker_conf["workers"]
DEBUG = docker_conf.get("debug", False)

logger = create_logger("check_prs", "prt.log")

# Disable pika logs
logging.getLogger("pika").propagate = False


def send_message_to_bot(msg):

    required_fields = set(["rabbitmq_url", "gh_queue", "gh_channel", "gh_message_type"])
    if not required_fields.issubset(docker_conf.viewkeys()):
        logger.warn("Skipping - docker.yaml doesn't have {}".format(required_fields))
        return

    logger.info("Github PR bot: about to send '{}'".format(msg))
예제 #10
0
    parser = argparse.ArgumentParser(argument_default=None)

    interaction = parser.add_argument_group('Ports')
    interaction.add_argument('--watch',
                             help='Opens VNC session',
                             action='store_true',
                             default=False)
    interaction.add_argument('--vnc',
                             help='Chooses VNC port',
                             default=random_port())
    interaction.add_argument('--webdriver',
                             help='Chooses WebDriver port',
                             default=random_port())
    interaction.add_argument('--image',
                             help='Chooses WebDriver port',
                             default=docker_conf.get('selff',
                                                     'cfme/sel_ff_chrome'))
    interaction.add_argument('--vncviewer',
                             help='Chooses VNC viewer command',
                             default=docker_conf.get('vncviewer', None))

    args = parser.parse_args()
    ip = '127.0.0.1'

    print("Starting container...")

    dkb = SeleniumDocker(bindings={
        'VNC_PORT': (5999, args.vnc),
        'WEBDRIVER': (4444, args.webdriver)
    },
                         image=args.image)
    dkb.run()
예제 #11
0
    def handle_output(self):
        if self.args['output']:
            print
            print "======================== \/ OUTPUT \/ ============================"
            print
            f = open(os.path.join(self.log_path, 'setup.txt'))
            print f.read()

if __name__ == "__main__":
    parser = argparse.ArgumentParser(argument_default=None)

    interaction = parser.add_argument_group('Interaction')
    interaction.add_argument('--banner', action='store_true',
                             help='Chooses upstream',
                             default=docker_conf.get('banner', False))
    interaction.add_argument('--watch', action='store_true',
                             help='Watch it via VNC',
                             default=None)
    interaction.add_argument('--output', action='store_true',
                             help="Output the console?",
                             default=None)

    appliance = parser.add_argument_group('Appliance Options')
    appliance.add_argument('--appliance-name',
                           help=('Chooses an appliance from the config by name'
                                 'or sets a name if used with --appliance'),
                           default='CLI Speficied')
    appliance.add_argument('--appliance',
                           help='Chooses an appliance address',
                           default=None)