예제 #1
0
 def test_ip_per_task_portMappings_null(self):
     app = {
         'ipAddress': {},
         'container': {
             'type': 'DOCKER',
             'docker': {
                 'network': 'USER',
                 'portMappings': None,
             },
         },
         'tasks': [{
             "id": "testtaskid",
             "ipAddresses": [{"ipAddress": "1.2.3.4"}]
         }],
         "portDefinitions": [
             {
                 'port': 10000,
             },
             {
                 'port': 10001,
             },
         ],
     }
     # Calling cleanup_json because all entrypoints to get_service_ports
     # also call cleanup_json, so None isn't expected at runtime
     self.assertEquals(self.assigner.get_service_ports(cleanup_json(app)),
                       [10000, 10001])
예제 #2
0
 def test_ip_per_task_portMappings_null_marathon15(self):
     app = {
         'container': {
             'type': 'DOCKER',
             'docker': {
                 'image': 'nginx'
             },
             'portMappings': None
         },
         'networks': [
             {
                 'mode': 'container',
                 'name': 'dcos'
             }
         ],
         'tasks': [{
             "id": "testtaskid",
             "ipAddresses": [{"ipAddress": "1.2.3.4"}]
         }],
     }
     # Calling cleanup_json because all entrypoints to get_service_ports
     # also call cleanup_json, so None isn't expected at runtime
     self.assertEquals(self.assigner.get_service_ports(cleanup_json(app)),
                       [])
예제 #3
0
def fetch_marathon_app(args, app_id):
    response = marathon_get_request(args, "/v2/apps" + app_id)
    return cleanup_json(response.json())['app']
예제 #4
0
def list_marathon_apps(args):
    response = marathon_get_request(args, "/v2/apps")
    return cleanup_json(response.json())['apps']
예제 #5
0
def load_app_json(args):
    with open(args.json) as content_file:
        return cleanup_json(json.load(content_file))
예제 #6
0
def fetch_marathon_app(args, app_id):
    response = marathon_get_request(args, "/v2/apps" + app_id)
    return cleanup_json(response.json())['app']
예제 #7
0
def list_marathon_apps(args):
    response = marathon_get_request(args, "/v2/apps")
    return cleanup_json(response.json())['apps']
예제 #8
0
def load_app_json(args):
    with open(args.json) as content_file:
        return cleanup_json(json.load(content_file))