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

Remove asset from range #156

Closed
wants to merge 10 commits into from
Closed

Remove asset from range #156

wants to merge 10 commits into from

Conversation

sgreen-r7
Copy link
Contributor

An effort to fix #148

This should correctly remove a single ip from a range.

end


def split_ip_range(ip_range, split_ip)

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!
Copy link
Contributor

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)

@erran-r7
Copy link
Contributor

erran-r7 commented Apr 7, 2015

@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)
Copy link
Contributor

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?

@98231jssa
Copy link

Hi,
I'll be able to test only next week and let you know,I actually would prefer a way to completely get rid of assets, not just blacklist them.
I'll anyway try and let you know.

Cheers and thanks for the fix!

On April 7, 2015 2:45:00 AM CEST, Erran Carey [email protected] wrote:

@sgreen-r7 can you import my tests from erran/rapid7-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.


Reply to this email directly or view it on GitHub:
#156 (comment)

Sent from my Android device with K-9 Mail. Please excuse my brevity.

end
end

def split_ip_range(ip_range, split_ip)

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]

@gschneider-r7
Copy link
Contributor

Don't forget to update this for 1.0 changes when this is looked at again.

@sgreen-r7
Copy link
Contributor Author

Will revisit later once feedback is received.

@sgreen-r7 sgreen-r7 closed this Aug 26, 2015
@sgreen-r7 sgreen-r7 deleted the remove_asset_from_range branch May 12, 2016 21:35
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.

Delete assets from sites if there is no deviceid
6 participants