-
-
Notifications
You must be signed in to change notification settings - Fork 108
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
WIP: Rework network_route provider with resource_api #245
base: master
Are you sure you want to change the base?
Conversation
exciting |
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.
just lookin
def routes_list | ||
routes = [] | ||
Net::IP.routes.each do |route| | ||
routes.push(route.instance_variables.each_with_object({}) { |var, hash| hash[var.to_s.delete("@")] = route.instance_variable_get(var) }) |
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.
it might aid readability to break this one-liner up logically into multiple lines
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.
Will definitely try and do that once I have the rest of the resource working.
So far it can get the routes on a system using the net-ip
ruby gem (which in turn uses ip route
)
32cc8e0
to
401fc2d
Compare
Signed-off-by: David Hollinger <[email protected]>
d076eb6
to
ec9599f
Compare
28e4840
to
d18dd76
Compare
lib/puppet/type/network_route_old.rb
Outdated
munge do |value| | ||
# '255.255.255.255'.to_i will return 255, so we try to convert it back: | ||
if value.to_i.to_s == value | ||
# what are the chances someone is using /16 for their IPv6 network? |
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.
I do that.
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.
That file is going away ;)
That said, I am looking for a way to transform a prefix length to subnet mask. Nothing seems to do it natively (plenty of libraries to transform from subnet mask to prefix length though).
687f3a1
to
9a08c21
Compare
1427fee
to
039f825
Compare
end | ||
|
||
it 'updates the resource' do | ||
expect(routes).to receive(:flush).with(netiproute.prefix) |
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.
netiproute
is a double. using a property of the double to access test data seems backwards.
Dear @dhollinger, thanks for the PR! This is pccibot, your friendly Vox Pupuli GitHub Bot. I noticed that your pull request contains merge conflict. Can you please rebase? You can find my sourcecode at voxpupuli/vox-pupuli-tasks |
Dear @dhollinger, thanks for the PR! This is pccibot, your friendly Vox Pupuli GitHub Bot. I noticed that your pull request contains merge conflict. Can you please rebase? You can find my sourcecode at voxpupuli/vox-pupuli-tasks |
Dear @dhollinger, thanks for the PR! This is pccibot, your friendly Vox Pupuli GitHub Bot. I noticed that your pull request contains merge conflict. Can you please rebase? You can find my sourcecode at voxpupuli/vox-pupuli-tasks |
1 similar comment
Dear @dhollinger, thanks for the PR! This is pccibot, your friendly Vox Pupuli GitHub Bot. I noticed that your pull request contains merge conflict. Can you please rebase? You can find my sourcecode at voxpupuli/vox-pupuli-tasks |
do not merge - this is for review only at this time.