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

Allow add-system CLI call to update systems as well #21

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mattheworiordan
Copy link
Contributor

I expect you won't want to incorporate the Rakefile update as this is just my personal preference to use Bundler for Gem creation, however the previous commit allows papertrail-add-system to update systems as well as add systems when the name already exists.

@eric
Copy link
Contributor

eric commented Sep 27, 2012

Would you mind making a pull request that doesn't include the changes to the .gemspec or Rakefile to make it simpler to merge?

@eric
Copy link
Contributor

eric commented Sep 27, 2012

Do you think it makes more sense to make papertrail-add-system do an update or should we have a papertrail-update-system command that is separate?

@mattheworiordan
Copy link
Contributor Author

Well I would argue add/update is the same thing, that's effectively how the API works. As it currently stands, if you call add and the system exists, no update is made and no notification is made either. My preference would be to either have add-system do both, or have a new method add-update-system which does both and leave add-system as is. But I don't think update-system is a realistic call as you won't often know if the system exists in the first place.

Once you confirm what you think is best, then I will make another pull request

@mattheworiordan
Copy link
Contributor Author

Any further thoughts on this?

@eric
Copy link
Contributor

eric commented Oct 3, 2012

Can you give me an idea what the use case is for needing to do an add-or-update? Maybe it'll help figure out the right name of it...

@mattheworiordan
Copy link
Contributor Author

I have an EC2 image for a machine which is used to deploy new machines in an auto-scaling group. On startup, they register themselves so that Papertrail allows logs from that IP, hence they call papertrail-add-system currently, which works the first time, but on reboot, if the host name changes, or another machine gets that IP, unfortunately the update never occurs.

@eric
Copy link
Contributor

eric commented Oct 5, 2012

Sorry for the long delay here.

I believe I've come up with an even better solution to this problem.

I've added a --destination-port option to papertrail-add-system that will allow you to create a new hostname on a customer-specific port without specifying an IP address.

This means you should be able to call:

$ papertrail-add-system --system <system name> --destination-port <your port>

as part of server boot and it'll ensure that that system name is registered. IP changes will be detected automatically.

This has been released as version 0.9.6. Please give it a spin and see if it solves the problem for you.

@mattheworiordan
Copy link
Contributor Author

I'm not sure I understand what this does to be honest (although admittedly I've only just skimmed the code on my mobile). If in my user case, where I need to register a server on start up, how would I actually use this? Surely I would first need to know if that system name / host had been registered first? That is what I was hoping to avoid, I want a system where you fire and forget knowing that your server has been registered correctly.

@eric
Copy link
Contributor

eric commented Oct 10, 2012

My thinking was, if you use this new way (of registering a hostname to send to a destination port), you won't need to specify the source IP, which means you can call papertrail-add-system multiple times (or once on boot) and there shouldn't be any adverse effect on the system.

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

Successfully merging this pull request may close these issues.

None yet

2 participants