Skip to content
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

Fixes #18180: Make rtf handle network hostonly uniqueness #254

Conversation

Fdall
Copy link
Contributor

@Fdall Fdall commented Sep 9, 2020

@Fdall Fdall requested a review from peckpeck September 9, 2020 09:47
lib/platform.py Outdated
# update promises on the whole chain
relays.append(server)
relays.reverse()
for h in relays:
h.run("rudder agent run -u", quiet=False, live_output=True, fail_exit=fail_exit)
host.run("rudder agent run -ui", quiet=False, live_output=True, fail_exit=fail_exit)

def pf_id_to_network(self, pf_id):
# Since the mask is always 255.255.255.0 this is reasonable
return ("192.168.%s.0"%(pf_id), "255.255.255.0")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the base network can be defines in the Vagrantfile, so you shouldn't hardcode 192.168. here an the mask is also in the Vagrantfile (see $NETWORK)

Copy link
Member

@peckpeck peckpeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use $NERWORK

@Fdall
Copy link
Contributor Author

Fdall commented Sep 9, 2020

PR updated with a new commit

lib/platform.py Outdated
base_subnet = "192.168.0.0/24"
with open("Vagrantfile", "r+") as fd:
for line in fd:
m = re.match("^\$NETWORK=[\'\"](.*)[\'\"]", line)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\s* are needed around =

lib/platform.py Outdated
print("Taking base network %s"%m.group(1))
base_subnet = m.group(1)
subnet = ipaddress.ip_network(base_subnet)
return (str(subnet.network_address + 256*pf_id), str(subnet.netmask))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

256 should be replaces by 2**(32-subnet.prefixlen)

@Fdall
Copy link
Contributor Author

Fdall commented Sep 9, 2020

PR updated with a new commit

1 similar comment
@Fdall
Copy link
Contributor Author

Fdall commented Sep 9, 2020

PR updated with a new commit

@Normation-Quality-Assistant

OK, squash merging this PR

@Normation-Quality-Assistant Normation-Quality-Assistant force-pushed the bug_18180/make_rtf_handle_network_hostonly_uniqueness branch from d806b7a to 4ff36c9 Compare September 10, 2020 14:47
@Normation-Quality-Assistant Normation-Quality-Assistant merged commit 4ff36c9 into Normation:master Sep 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants