summaryrefslogtreecommitdiffstats
path: root/deploy/config/network.py
blob: ed14f95b054cfe7b60ba2b5fad0ba3b297e993cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import yaml

from deploy.common import query


class NetworkConfig(object):
    def __init__(self, network_file):
        self._file = network_file
        self._get_config()

    def _get_config(self):
        self.config = yaml.safe_load(file(self._file))

    def _get_network(self, name):
        return query.find(lambda item: item['name'] == name,
                          self.config['networks'])

    @property
    def external_network(self):
        return self._get_network('EXTERNAL')