Пример #1
0
def working_marathon(context):
    """Adds a working marathon client as context.client for the purposes of
    interacting with it in the test."""
    if not hasattr(context, 'client'):
        marathon_connection_string = "http://%s" % \
            get_marathon_connection_string()
        context.client = marathon.MarathonClient(marathon_connection_string)
Пример #2
0
 def __attrs_post_init__(self):
     self._session = requests.Session()
     self._client = marathon.MarathonClient(
         ['http://' + h for h in self.dcos_hosts],
         session=self._session)
     try:
         # TODO: more correct handling of URLs here
         host = self.dcos_hosts[0]
         if ':' in host:  # NOTE: beware IPv6
             host = host.split(':')[0]
         socket.gethostbyname(host)
     except socket.gaierror:
         self._logger.comment(
             self.dcos_hosts[0] +
             ' did not resolve; using localhost:8080 http socks5 proxy')
         self._session.proxies = { 'http': 'socks5h://localhost:8080' }
Пример #3
0
 def __init__(self, uri, appid):
     super(MarathonAppManager, self).__init__()
     self._marathon_uri = uri
     self._appid = appid
     self._marathon_client = marathon.MarathonClient(uri)
def running_marathon_instance(context):
    context.client = marathon.MarathonClient('http://marathon:8080/')
    wait_for_marathon(context)
    delete_existing_apps(context)
        '--event-store',
        default='in-memory://localhost/',
        help='event store connection string (default: in-memory://localhost/)')
    parser.add_argument('-p',
                        '--port',
                        type=int,
                        default=5000,
                        help='Port to listen on (default: 5000)')
    parser.add_argument('-i',
                        '--ip',
                        default='0.0.0.0',
                        help='IP to listen on (default: 0.0.0.0)')
    args = parser.parse_args()

    event_store_url = urlparse.urlparse(args.event_store)

    if event_store_url.scheme == 'in-memory':
        event_store = InMemoryStore(event_store_url)
    elif event_store_url.scheme == 'syslog':
        event_store = SyslogUdpStore(event_store_url)
    else:
        print 'Invalid event store type: "{scheme}" (from "{url}")'.format(
            scheme=event_store_url.scheme, url=args.event_store)
        sys.exit(1)

    m = marathon.MarathonClient(args.marathon_url)
    m.create_event_subscription(args.callback_url)
    atexit.register(on_exit, m, args.callback_url)

    app.run(port=args.port, host=args.ip)