Exemple #1
0
 def test_parse_environment_as_dict(self):
     environment = {
         'NORMAL': 'F1',
         'CONTAINS_EQUALS': 'F=2',
         'TRAILING_EQUALS': None,
     }
     self.assertEqual(config.parse_environment(environment), environment)
Exemple #2
0
 def test_parse_environment_as_dict(self):
     environment = {
         'NORMAL': 'F1',
         'CONTAINS_EQUALS': 'F=2',
         'TRAILING_EQUALS': None,
     }
     self.assertEqual(config.parse_environment(environment), environment)
def build_container_options(options, detach, command):
    container_options = {
        'command': command,
        'tty': not (detach or options['-T'] or not sys.stdin.isatty()),
        'stdin_open': not detach,
        'detach': detach,
    }

    if options['-e']:
        container_options['environment'] = parse_environment(options['-e'])

    if options['--entrypoint']:
        container_options['entrypoint'] = options.get('--entrypoint')

    if options['--rm']:
        container_options['restart'] = None

    if options['--user']:
        container_options['user'] = options.get('--user')

    if not options['--service-ports']:
        container_options['ports'] = []

    if options['--publish']:
        container_options['ports'] = options.get('--publish')

    if options['--name']:
        container_options['name'] = options['--name']

    if options['--workdir']:
        container_options['working_dir'] = options['--workdir']

    return container_options
def build_container_options(options, detach, command):
    container_options = {
        'command': command,
        'tty': not (detach or options['-T'] or not sys.stdin.isatty()),
        'stdin_open': not detach,
        'detach': detach,
    }

    if options['-e']:
        container_options['environment'] = parse_environment(options['-e'])

    if options['--entrypoint']:
        container_options['entrypoint'] = options.get('--entrypoint')

    if options['--rm']:
        container_options['restart'] = None

    if options['--user']:
        container_options['user'] = options.get('--user')

    if not options['--service-ports']:
        container_options['ports'] = []

    if options['--publish']:
        container_options['ports'] = options.get('--publish')

    if options['--name']:
        container_options['name'] = options['--name']

    if options['--workdir']:
        container_options['working_dir'] = options['--workdir']

    return container_options
Exemple #5
0
 def test_parse_environment_as_list(self):
     environment = [
         'NORMAL=F1',
         'CONTAINS_EQUALS=F=2',
         'TRAILING_EQUALS=',
     ]
     self.assertEqual(
         config.parse_environment(environment),
         {'NORMAL': 'F1', 'CONTAINS_EQUALS': 'F=2', 'TRAILING_EQUALS': ''},
     )
 def test_parse_environment_as_list(self):
     environment = [
         'NORMAL=F1',
         'CONTAINS_EQUALS=F=2',
         'TRAILING_EQUALS=',
     ]
     self.assertEqual(
         config.parse_environment(environment),
         {'NORMAL': 'F1', 'CONTAINS_EQUALS': 'F=2', 'TRAILING_EQUALS': ''},
     )
Exemple #7
0
 def test_parse_environment_empty(self):
     self.assertEqual(config.parse_environment(None), {})
Exemple #8
0
 def test_parse_environment_invalid(self):
     with self.assertRaises(config.ConfigurationError):
         config.parse_environment('a=b')
Exemple #9
0
 def test_parse_environment_empty(self):
     self.assertEqual(config.parse_environment(None), {})
Exemple #10
0
 def test_parse_environment_invalid(self):
     with self.assertRaises(config.ConfigurationError):
         config.parse_environment('a=b')
Exemple #11
0
 def test_parse_environment_as_dict(self):
     environment = {"NORMAL": "F1", "CONTAINS_EQUALS": "F=2", "TRAILING_EQUALS": None}
     self.assertEqual(config.parse_environment(environment), environment)
Exemple #12
0
 def test_parse_environment_as_list(self):
     environment = ["NORMAL=F1", "CONTAINS_EQUALS=F=2", "TRAILING_EQUALS="]
     self.assertEqual(
         config.parse_environment(environment), {"NORMAL": "F1", "CONTAINS_EQUALS": "F=2", "TRAILING_EQUALS": ""}
     )