Exemple #1
0
    def postOptions(self):
        """
        Merge our commandline arguments with our config file.
        """
        # Inject some default values into the config.  Right now this is
        # only used to support distinguishing between staging and production.
        self.update({
            'regionOverrides': {},
            'cloudServersOpenStack': 'cloudServersOpenStack',
            'cloudLoadBalancers': 'cloudLoadBalancers'
        })

        self.update(jsonfig.from_path(self['config']))

        # The staging service catalog has some unfortunate differences
        # from the production one, so these are here to hint at the
        # correct ocnfiguration for staging.
        if self.get('environment') == 'staging':
            self['cloudServersOpenStack'] = 'cloudServersPreprod'
            self['regionOverrides']['cloudLoadBalancers'] = 'STAGING'
Exemple #2
0
    def postOptions(self):
        """
        Merge our commandline arguments with our config file.
        """
        # Inject some default values into the config.  Right now this is
        # only used to support distinguishing between staging and production.
        self.update({
            'regionOverrides': {},
            'cloudServersOpenStack': 'cloudServersOpenStack',
            'cloudLoadBalancers': 'cloudLoadBalancers'
        })

        self.update(jsonfig.from_path(self['config']))

        # The staging service catalog has some unfortunate differences
        # from the production one, so these are here to hint at the
        # correct ocnfiguration for staging.
        if self.get('environment') == 'staging':
            self['cloudServersOpenStack'] = 'cloudServersPreprod'
            self['regionOverrides']['cloudLoadBalancers'] = 'STAGING'
Exemple #3
0
    def test_from_path_parses_json_into_dictionary(self):
        with NamedTemporaryFile() as f:
            f.write('{ "foo": "bar", "bim": "baz" }')
            f.flush()

            instance = jsonfig.from_path(f.name)
            self.assertEqual("bar", instance["foo"])
            self.assertEqual("baz", instance["bim"])

            # sleep here for the mtime rollover
            time.sleep(1)

            f.seek(0)
            f.truncate()
            f.write('{ "need": "there is none" }')
            f.flush()

            time.sleep(1)
            self.assertEqual("there is none", instance["need"])
            self.assertRaises(KeyError, lambda: instance["foo"])
            self.assertRaises(KeyError, lambda: instance["bim"])
Exemple #4
0
 def postOptions(self):
     """
     Merge our commandline arguments with our config file.
     """
     self.update(jsonfig.from_path(self['config']))
Exemple #5
0
import os

import jsonfig


_filename = os.path.join(os.path.dirname(__file__), 'config.json')

config = jsonfig.from_path(_filename)
Exemple #6
0
import os

import jsonfig

_filename = os.path.join(os.path.dirname(__file__), 'config.json')

config = jsonfig.from_path(_filename)