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

Adding criteria to tag. #209

Closed
pavedian opened this issue Feb 8, 2016 · 6 comments
Closed

Adding criteria to tag. #209

pavedian opened this issue Feb 8, 2016 · 6 comments

Comments

@pavedian
Copy link

pavedian commented Feb 8, 2016

I've noticed when attempting to open an existing tag and adding another IP_Range it just overwrite the existing one.

Is there a clear way to add the same crtieria again instead of overwriting? I may be doing something wrong but I noticed when I attempt to open an existing tag the data is just overwritten.

@sgreen-r7
Copy link
Contributor

Hi @pavedian,

Can you copy and paste the code you're using to add an ip to an existing tag? That will help us answer the question easier/quicker.

Thanks!

@pavedian
Copy link
Author

pavedian commented Feb 8, 2016

I've attached the script. Thank you for taking the time to respond!

iprangetagging.txt

@gschneider-r7
Copy link
Contributor

You're overwriting the criteria of the tag and then adding the range criterion to it (which you also did earlier in the script):

old_tag.search_criteria = criteria #overwrites original criteria
old_tag.search_criteria.criteria << range  #adds criterion to criteria (again)

If you only did the second part it should work as expected.

@pavedian
Copy link
Author

pavedian commented Feb 8, 2016

yes! you are correct and it worked. thanks for that!

@sgreen-r7
Copy link
Contributor

I agree with @gschneider-r7 @pavedian,

old_tag.search_criteria = criteria
old_tag.search_criteria.criteria << range

If you fix that line, and do something to the effect of:

old_tag.search_criteria = criteria if old_tag.search_criteria.nil?

That should do what you're looking to do. Because what looks to be happening is you're setting old_tag.search_criteria to a brand new Tag::Criteria.new every time.

Give that a shot, and let us know how it goes.

@sgreen-r7
Copy link
Contributor

Awesome, glad to hear it worked @pavedian -- going to go ahead and close the issue now.
Let us know if you ever have any other questions, or run into issues in the future.

Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants