-
Notifications
You must be signed in to change notification settings - Fork 103
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
Remove asset from range #156
Conversation
…y split a IPRange when removing an ip.
end | ||
|
||
|
||
def split_ip_range(ip_range, split_ip) |
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.
Assignment Branch Condition size for split_ip_range is too high. [25.16/15]
asset = split_ip_range(asset_range, ip) | ||
@assets.delete(asset_range) | ||
@assets.push(asset) | ||
@assets.flatten! |
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.
Instead of calling Array#flatten!
, you can use Array#+
which keeps things one-dimensional:
assets += Array(asset)
@sgreen-r7 can you import my tests from erran/nexpose-client's bug/148-allow-the-deletion-of-assets-in-ranges branch? See also my changes — master...erran:bug/148-allow-the-deletion-of-assets-in-ranges I was going to wait for @98231jssa's feedback before clicking the create PR button. |
ip = IPRange.new(ip) | ||
@assets.each do |asset_range| | ||
next if asset_range.is_a?(Nexpose::HostName) | ||
if asset_range.include?(ip) |
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.
How about an early return (next if
like above) here since there is no alternative?
Hi, Cheers and thanks for the fix! On April 7, 2015 2:45:00 AM CEST, Erran Carey [email protected] wrote:
Sent from my Android device with K-9 Mail. Please excuse my brevity. |
…at is not needed.
end | ||
end | ||
|
||
def split_ip_range(ip_range, split_ip) |
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.
Assignment Branch Condition size for split_ip_range is too high. [25.16/15]
Don't forget to update this for 1.0 changes when this is looked at again. |
Will revisit later once feedback is received. |
An effort to fix #148
This should correctly remove a single ip from a range.