New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE] Add Provider for domain_code #55
Conversation
Sieht gut aus, ist einfacher als wenn man bei jedem Gateway einzeln die Domain in den alias.json eintragen muss |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall good. Necessary changes are small, thus I'll implement them myself.
@@ -38,6 +38,7 @@ def handle(self): | |||
# Clone global environment and populate with interface-specific data | |||
local_env = dict(env) | |||
local_env['batadv_dev'] = batadv_dev | |||
local_env['domain_code'] = domain_code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we put that in the local_env
? Isn't that a global setting? Think this should go here:
Line 103 in 2635b00
get_handler(get_providers(args.directory), batadv_ifaces, batadv_mesh_ipv4_overrides, {'mesh_ipv4': args.mesh_ipv4}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I probably misunderstood how the local_env is used exactly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, local_env
is intended for values that can change per request. In contrast the global environment - which was hard to spot since it is only passed as a function argument - contains values that are fixed, no matter what interface a request is received on.
@@ -78,6 +79,9 @@ def handle(self): | |||
parser.add_argument('-m', dest='mesh_ipv4', | |||
metavar='<mesh_ipv4>', | |||
help='mesh ipv4 address') | |||
parser.add_argument('-n', dest='domain_code', | |||
metavar='domain_code', | |||
help='Domain Code for system/domain_code') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be a reasonable default for this value. I'd suggest setting it to 'default'
when -n
is not specified.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need a default? If nothing is set, there should be no domain transmitted (as it is now)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, ok. That is a side effect of having a None
value in there then. I would have expected it to break due to an exception somewhere in handler processing when a handler returns None
.
I'll add an is_enabled
method to data sources so they can signal wether they should be called or not. This seems a lot clearer to me than handling None
values all the time.
I'd suggest this solution: https://github.com/ffnord/mesh-announce/compare/master...TobleMiner:feature-domain-name?expand=1 Please test and leave feedback. |
The "is_enabled" flag seems to be broken at the moment:
|
Ah, my fault. Need to proxy the call through the Source object. Should be fixed now. Please try again. |
Test without and with the Gateway-Option was successfull, everything okay from my side. |
Just tested it as well. Seems to work fine. |
Merged, thanks for the PR! |
Is there an option to set the domain_code without starting multiple instances (in a multi-domain Setup)? From the README.md this seems to be the way to start mesh-announce for a multi-domain site: As far as i can see, it is only possible to specify a single |
Hm, right. That is kind of required. However currently it is not possible. It's actually an option that would probably need to be attached to the |
This PR adds a provider for domain_code, which allows to display the domain of the gateway inside meshviewer etc.
Example usage: https://map.ffm.freifunk.net/#!/de/map/aaff04000802