Skip to content

Commit

Permalink
Add domain_code to provider env
Browse files Browse the repository at this point in the history
  • Loading branch information
TobleMiner committed Sep 7, 2020
1 parent 3905f56 commit 2736f7b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
8 changes: 7 additions & 1 deletion domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ class Domain():
def __init__(self, config):
self.config = config

def get_name(self):
return self.config.name

def get_ipv4_gateway(self):
return self.config.ipv4_gateway

Expand All @@ -25,7 +28,10 @@ def get_provider_args(self):
''' Returns dict of parameters respondd queries are
expected to arrive on
'''
return { 'mesh_ipv4': self.get_ipv4_gateway() }
return {
'domain_code': self.get_name(),
'mesh_ipv4': self.get_ipv4_gateway()
}

class BatadvDomain(Domain):
''' Container object for a batman freifunk domain
Expand Down
9 changes: 3 additions & 6 deletions providers/nodeinfo/system/domain_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@

class Source(providers.DataSource):
def required_args(self):
return ['batadv_dev', 'domain_code', 'known_codes']
return ['domain_code']

def call(self, batadv_dev, domain_code, known_codes):
try:
return known_codes[batadv_dev]
except KeyError:
return domain_code
def call(self, domain_code):
return domain_code

0 comments on commit 2736f7b

Please sign in to comment.