Exemplo n.º 1
0
 def test_replacement(self):
     """Ensure that the new entries in B replace equivalents in A"""
     a = DotDict(a=1, b=1)
     b = DotDict(b=2)
     c = merge_dicts(a, b)
     self.assertEqual(c.a, 1)
     self.assertEqual(c.b, 2)
Exemplo n.º 2
0
def update(config):
    data_path = os.path.join(config.deploy.root, 'graphite', 'data')
    new = {
        'graphite': {
            'path': {
                'data': data_path,
                'log_dir': '/var/log/graphite',
            },
            'db': {
                'name': 'graphite',
                'engine': 'django.db.backends.mysql',
                'user': '',
                'password': '',
                'host': '',
                'port': '',
            },
            'domain': 'graphite.%s' % config.common.domain.services,
            'htpasswd': {
                'users': {
                    'yola': MissingValue(),
                },
            },
            'ssl': config.common.wild_ssl_certs.services,
        },
    }
    return merge_dicts(config, new)
Exemplo n.º 3
0
def update(config):
    new = {
        'nginx-app': {
            'nginx_specific_key': 'some_value',
        },
    }
    return merge_dicts(config, new)
Exemplo n.º 4
0
def update(config):
    new = {
        'basic-configed': {
            'secret': 'sauce',
        }
    }
    return merge_dicts(config, new)
Exemplo n.º 5
0
 def test_merge_lists(self):
     """Ensure that leaf lists are merged"""
     a = DotDict(a=1, sub=[1, 2])
     b = DotDict(b=2, sub=[3, 4])
     c = merge_dicts(a, b)
     self.assertEqual(c.a, 1)
     self.assertEqual(c.b, 2)
     self.assertEqual(c.sub, [1, 2, 3, 4])
Exemplo n.º 6
0
 def test_replace_missing_with_dict(self):
     """Ensure that a subtree from B replaces a MissingValue in A"""
     a = DotDict(a=1, sub=MissingValue('sub'))
     b = DotDict(b=2, sub={'c': 2})
     c = merge_dicts(a, b)
     self.assertEqual(c.a, 1)
     self.assertEqual(c.b, 2)
     self.assertEqual(c.sub.c, 2)
Exemplo n.º 7
0
 def test_sub_replacement(self):
     """Ensure that a subtree from B is merged with the same subtree in A"""
     a = DotDict(a=1, sub={'c': 1})
     b = DotDict(b=2, sub={'c': 2})
     c = merge_dicts(a, b)
     self.assertEqual(c.a, 1)
     self.assertEqual(c.b, 2)
     self.assertEqual(c.sub.c, 2)
def update(config):
    new = {
        'conftpl': {
            'secret': 'sauce',
            'msg': 'snowman!',
        }
    }
    return merge_dicts(config, new)
Exemplo n.º 9
0
 def test_merge(self):
     """Ensure that the new entries in B are merged into A"""
     a = DotDict(a=1, b=1)
     b = DotDict(c=1)
     c = merge_dicts(a, b)
     self.assertEqual(c.a, 1)
     self.assertEqual(c.b, 1)
     self.assertEqual(c.c, 1)
Exemplo n.º 10
0
def update(config):
    add = {
        'common': {
            'exampleservice': {
                'url': 'http://example.com/'
            },
        }
    }
    return merge_dicts(config, add)
Exemplo n.º 11
0
def update(config):
    new = {
        'apache-whitelabel': {
            'domain': {
                'yola': 'http://appname.yola',
                'wl': 'http://appname.wl',
            }
        }
    }
    return merge_dicts(config, new)
Exemplo n.º 12
0
def update(config):
    new = {
        'txstatsd': {
            'port': 8125,
            'flush_interval': 60000,
            'path': {
                'log': '/var/log/txstatsd.log',
            },
        },
    }
    return merge_dicts(config, new)
Exemplo n.º 13
0
def update(config):
    add = {
        'common': {
            'wild_ssl_certs': {
                'services': {
                    'cert': '/etc/ssl/wildcard.example.net.pem',
                    'private': '/etc/ssl/wildcard.example.net.key',
                },
            },
        },
    }
    return merge_dicts(config, add)
Exemplo n.º 14
0
def update(config):
    s_domain = config.common.domain.services
    add = {
        'common': {
            'graphite_carbon': {
                'host': 'graphite.%s' % s_domain,
                'text_port': 2003,
                'pickle_port': 2004,
            },
        },
    }
    return merge_dicts(config, add)
Exemplo n.º 15
0
def update(config):
    add = {
        'common': {
            'domain': {
                'services': 'example.net',
            },
        },
        'deploy': {
            'root': '/srv/'
        },
    }
    return merge_dicts(config, add)
Exemplo n.º 16
0
def update(config):
    add = {
        'graphite': {
            'htpasswd': {
                'users': {
                    'yola': 'super secret password',
                },
            },
        },
    }

    return merge_dicts(config, add)
def update(config):
    new = {
        'apache-hosted-django-multisite': {
            'domains': {
                'siteone': 'http://site-one.test',
                'sitetwo': 'http://site-two.test',
            },
            'environ': {
                'foo': 'bar'
            },
        },
    }
    return merge_dicts(config, new)
Exemplo n.º 18
0
def update(config):
    new = {
        'apache-app': {
            'domain': 'http://sampleservice.test',
            'cache': {
                'maxage': 60 * 60 * 60 * 24 * 365
            },
            'foo': {
                'url': 'http://foo.site'
            },
        }
    }
    return merge_dicts(config, new)
Exemplo n.º 19
0
def update(config):
    new = {
        'django-app': {
            'domain': 'http://djangoapp.test',
            'environ': {
                'foo': 'bar'
            },
            'path': {
                'log': os.path.join(log_dir, 'app.log'),
                'celery_log': os.path.join(log_dir, 'app-celery.log'),
            }
        },
    }
    return merge_dicts(config, new)
Exemplo n.º 20
0
def update(config):
    data_path = os.path.abspath(os.path.join(os.path.dirname(__file__),
                                             '..', '..', 'data'))
    new = {
        'graphite': {
            'path': {
                'data': data_path,
                'log_dir': '%s/logs/' % data_path,
            },
            'db': {
                'name': os.path.join(data_path, 'graphite.sqlite'),
                'engine': 'django.db.backends.sqlite3',
            },
        },
    }
    return merge_dicts(config, new)
Exemplo n.º 21
0
def update(config):
    new = {
        'myapp': {
            'secret': 'sauce',
            'hello': 'world',
            'some': {
                'deeply': {
                    'nested': {
                        'value': 'Stefano likes beer'
                    },
                },
            },
            'oz': {
                'tigers': True,
                'lions': True,
                'bears': True,
                'zebras': False,
            },
        }
    }
    return merge_dicts(config, new)
Exemplo n.º 22
0
 def test_unnamed_missing_value_in_new_tree(self):
     """Ensure that missing values in new sub-trees get a name assigned"""
     a = DotDict()
     b = DotDict(foo={'bar': MissingValue()})
     c = merge_dicts(a, b)
     self.assertEqual(c.foo.bar.name, 'foo.bar')
Exemplo n.º 23
0
 def test_unnamed_missing_value(self):
     """Ensure that missing values get a name assigned"""
     a = DotDict()
     b = DotDict(foo=MissingValue())
     c = merge_dicts(a, b)
     self.assertEqual(c.foo.name, 'foo')
Exemplo n.º 24
0
 def test_replace_none(self):
     """Ensure that None can be replaced with another type"""
     a = DotDict(foo=None)
     b = DotDict(foo='foo')
     c = merge_dicts(a, b)
     self.assertEqual(c, {'foo': 'foo'})
Exemplo n.º 25
0
 def test_deltedvalue(self):
     """Ensure that deletedvalue deletes values"""
     a = DotDict(foo=42)
     b = DotDict(foo=DeletedValue())
     c = merge_dicts(a, b)
     self.assertEqual(c, {})