Writing a Start Handler


#1

I’m trying to write a start handler. I’ve managed to get

start_handlers << Chef::Reporting::StartHandler.new()

into the client.rb file. Obviously, I need to change the details. Now, I’m
reading http://docs.getchef.com/handlers.html and under the 'Reporting’
section it talks about how to install the handler, but it doesn’t say where
the start_handler.rb file goes.

Does it go in a cookbook? This would seem to be a problem to me as the
handler needs to be deployed before chef runs.

Doug


#2

can be anywhere in you system. if its in arbitrary path, you have to supply
the entire path (without .rb extension) in require, if its anywhere in
$LOAD_PATH, then just the file name (without the .rb extension).

require ‘foo’ # if foo.rb is anywhere in $LOAD_PATH
require ‘/home/doug/foo’ # when /home/doug is outside $LOAD_PATH

cheers
ranjib

On Tue, Aug 19, 2014 at 9:56 AM, Douglas Garstang doug.garstang@gmail.com
wrote:

I’m trying to write a start handler. I’ve managed to get

start_handlers << Chef::Reporting::StartHandler.new()

into the client.rb file. Obviously, I need to change the details. Now, I’m
reading http://docs.getchef.com/handlers.html and under the 'Reporting’
section it talks about how to install the handler, but it doesn’t say where
the start_handler.rb file goes.

Does it go in a cookbook? This would seem to be a problem to me as the
handler needs to be deployed before chef runs.

Doug


#3

Ranjib,

How does it get deployed though? Via chef or via other means? What require
are you referring to? There is no require in the client.rb file.

Doug.

On Tue, Aug 19, 2014 at 10:10 AM, Ranjib Dey dey.ranjib@gmail.com wrote:

can be anywhere in you system. if its in arbitrary path, you have to
supply the entire path (without .rb extension) in require, if its anywhere
in $LOAD_PATH, then just the file name (without the .rb extension).

require ‘foo’ # if foo.rb is anywhere in $LOAD_PATH
require ‘/home/doug/foo’ # when /home/doug is outside $LOAD_PATH

cheers
ranjib

On Tue, Aug 19, 2014 at 9:56 AM, Douglas Garstang <doug.garstang@gmail.com

wrote:

I’m trying to write a start handler. I’ve managed to get

start_handlers << Chef::Reporting::StartHandler.new()

into the client.rb file. Obviously, I need to change the details. Now,
I’m reading http://docs.getchef.com/handlers.html and under the
’Reporting’ section it talks about how to install the handler, but it
doesn’t say where the start_handler.rb file goes.

Does it go in a cookbook? This would seem to be a problem to me as the
handler needs to be deployed before chef runs.

Doug


Regards,

Douglas Garstang
http://www.linkedin.com/in/garstang
Email: doug.garstang@gmail.com
Cell: +1-805-340-5627


#4

by chef itself, generally. chef_handler cookbook provides a nifty lwrp to
do this as well. one pattern i have seen is to drop the file using
cookbook_file during compile time, followed by chef_handler lwrp invocation
(which will reconfigure chef internally). Its not a clean solution.

I prefer to break down node provisioning in stages (lvm, chef client
configs, chef_gems in one , rest of the stuff in another).

cheers
ranjib

On Tue, Aug 19, 2014 at 10:16 AM, Douglas Garstang doug.garstang@gmail.com
wrote:

Ranjib,

How does it get deployed though? Via chef or via other means? What require
are you referring to? There is no require in the client.rb file.

Doug.

On Tue, Aug 19, 2014 at 10:10 AM, Ranjib Dey dey.ranjib@gmail.com wrote:

can be anywhere in you system. if its in arbitrary path, you have to
supply the entire path (without .rb extension) in require, if its anywhere
in $LOAD_PATH, then just the file name (without the .rb extension).

require ‘foo’ # if foo.rb is anywhere in $LOAD_PATH
require ‘/home/doug/foo’ # when /home/doug is outside $LOAD_PATH

cheers
ranjib

On Tue, Aug 19, 2014 at 9:56 AM, Douglas Garstang <
doug.garstang@gmail.com> wrote:

I’m trying to write a start handler. I’ve managed to get

start_handlers << Chef::Reporting::StartHandler.new()

into the client.rb file. Obviously, I need to change the details. Now,
I’m reading http://docs.getchef.com/handlers.html and under the
’Reporting’ section it talks about how to install the handler, but it
doesn’t say where the start_handler.rb file goes.

Does it go in a cookbook? This would seem to be a problem to me as the
handler needs to be deployed before chef runs.

Doug


Regards,

Douglas Garstang
http://www.linkedin.com/in/garstang
Email: doug.garstang@gmail.com
Cell: +1-805-340-5627


#5

So it sounds like your basically saying this is a mess.

On Tue, Aug 19, 2014 at 10:22 AM, Ranjib Dey dey.ranjib@gmail.com wrote:

by chef itself, generally. chef_handler cookbook provides a nifty lwrp to
do this as well. one pattern i have seen is to drop the file using
cookbook_file during compile time, followed by chef_handler lwrp invocation
(which will reconfigure chef internally). Its not a clean solution.

I prefer to break down node provisioning in stages (lvm, chef client
configs, chef_gems in one , rest of the stuff in another).

cheers
ranjib

On Tue, Aug 19, 2014 at 10:16 AM, Douglas Garstang <
doug.garstang@gmail.com> wrote:

Ranjib,

How does it get deployed though? Via chef or via other means? What
require are you referring to? There is no require in the client.rb file.

Doug.

On Tue, Aug 19, 2014 at 10:10 AM, Ranjib Dey dey.ranjib@gmail.com
wrote:

can be anywhere in you system. if its in arbitrary path, you have to
supply the entire path (without .rb extension) in require, if its anywhere
in $LOAD_PATH, then just the file name (without the .rb extension).

require ‘foo’ # if foo.rb is anywhere in $LOAD_PATH
require ‘/home/doug/foo’ # when /home/doug is outside $LOAD_PATH

cheers
ranjib

On Tue, Aug 19, 2014 at 9:56 AM, Douglas Garstang <
doug.garstang@gmail.com> wrote:

I’m trying to write a start handler. I’ve managed to get

start_handlers << Chef::Reporting::StartHandler.new()

into the client.rb file. Obviously, I need to change the details. Now,
I’m reading http://docs.getchef.com/handlers.html and under the
’Reporting’ section it talks about how to install the handler, but it
doesn’t say where the start_handler.rb file goes.

Does it go in a cookbook? This would seem to be a problem to me as the
handler needs to be deployed before chef runs.

Doug


Regards,

Douglas Garstang
http://www.linkedin.com/in/garstang
Email: doug.garstang@gmail.com
Cell: +1-805-340-5627


Regards,

Douglas Garstang
http://www.linkedin.com/in/garstang
Email: doug.garstang@gmail.com
Cell: +1-805-340-5627


#6

im not saying, you are interpreting it like that. This is fairly advance
usage, as you are re-configuring chef using chef. there are clean work
around, if you read a bit of ruby or chef apis. Unlike puppet, chef is free
form (in fact its a trait coming from ruby) and can be used/abused in
myriad of ways. the assumption is you know best what you want to do. for
example if you have kickstart or spacewalk or cobbler in place, this can be
done on their side as well. For cloud based deployments, you can use images
with baked in chef configs, for others you can also use custom bootstrap
scripts. So, there are more than one clean way to do this, but chef also
allows it do it via chef (and there are reasons to support that as well).

On Tue, Aug 19, 2014 at 10:24 AM, Douglas Garstang doug.garstang@gmail.com
wrote:

So it sounds like your basically saying this is a mess.

On Tue, Aug 19, 2014 at 10:22 AM, Ranjib Dey dey.ranjib@gmail.com wrote:

by chef itself, generally. chef_handler cookbook provides a nifty lwrp to
do this as well. one pattern i have seen is to drop the file using
cookbook_file during compile time, followed by chef_handler lwrp invocation
(which will reconfigure chef internally). Its not a clean solution.

I prefer to break down node provisioning in stages (lvm, chef client
configs, chef_gems in one , rest of the stuff in another).

cheers
ranjib

On Tue, Aug 19, 2014 at 10:16 AM, Douglas Garstang <
doug.garstang@gmail.com> wrote:

Ranjib,

How does it get deployed though? Via chef or via other means? What
require are you referring to? There is no require in the client.rb file.

Doug.

On Tue, Aug 19, 2014 at 10:10 AM, Ranjib Dey dey.ranjib@gmail.com
wrote:

can be anywhere in you system. if its in arbitrary path, you have to
supply the entire path (without .rb extension) in require, if its anywhere
in $LOAD_PATH, then just the file name (without the .rb extension).

require ‘foo’ # if foo.rb is anywhere in $LOAD_PATH
require ‘/home/doug/foo’ # when /home/doug is outside $LOAD_PATH

cheers
ranjib

On Tue, Aug 19, 2014 at 9:56 AM, Douglas Garstang <
doug.garstang@gmail.com> wrote:

I’m trying to write a start handler. I’ve managed to get

start_handlers << Chef::Reporting::StartHandler.new()

into the client.rb file. Obviously, I need to change the details. Now,
I’m reading http://docs.getchef.com/handlers.html and under the
’Reporting’ section it talks about how to install the handler, but it
doesn’t say where the start_handler.rb file goes.

Does it go in a cookbook? This would seem to be a problem to me as the
handler needs to be deployed before chef runs.

Doug


Regards,

Douglas Garstang
http://www.linkedin.com/in/garstang
Email: doug.garstang@gmail.com
Cell: +1-805-340-5627


Regards,

Douglas Garstang
http://www.linkedin.com/in/garstang
Email: doug.garstang@gmail.com
Cell: +1-805-340-5627


#7

Ranjib,

You said that using chef_handler is not an idea solution. If we look at the
alternatives, I still don’t understand where to put the files. You
mentioned a require statement. There’s no require statement in the
client.rb file, so I don’t know where that’s supposed to go. If the files
are present on the AMI before chef runs, I don’t know where to place these
files. Documentation would be immensely helpful.

Douglas.

On Tue, Aug 19, 2014 at 10:36 AM, Ranjib Dey dey.ranjib@gmail.com wrote:

im not saying, you are interpreting it like that. This is fairly advance
usage, as you are re-configuring chef using chef. there are clean work
around, if you read a bit of ruby or chef apis. Unlike puppet, chef is free
form (in fact its a trait coming from ruby) and can be used/abused in
myriad of ways. the assumption is you know best what you want to do. for
example if you have kickstart or spacewalk or cobbler in place, this can be
done on their side as well. For cloud based deployments, you can use images
with baked in chef configs, for others you can also use custom bootstrap
scripts. So, there are more than one clean way to do this, but chef also
allows it do it via chef (and there are reasons to support that as well).

On Tue, Aug 19, 2014 at 10:24 AM, Douglas Garstang <
doug.garstang@gmail.com> wrote:

So it sounds like your basically saying this is a mess.

On Tue, Aug 19, 2014 at 10:22 AM, Ranjib Dey dey.ranjib@gmail.com
wrote:

by chef itself, generally. chef_handler cookbook provides a nifty lwrp
to do this as well. one pattern i have seen is to drop the file using
cookbook_file during compile time, followed by chef_handler lwrp invocation
(which will reconfigure chef internally). Its not a clean solution.

I prefer to break down node provisioning in stages (lvm, chef client
configs, chef_gems in one , rest of the stuff in another).

cheers
ranjib

On Tue, Aug 19, 2014 at 10:16 AM, Douglas Garstang <
doug.garstang@gmail.com> wrote:

Ranjib,

How does it get deployed though? Via chef or via other means? What
require are you referring to? There is no require in the client.rb file.

Doug.

On Tue, Aug 19, 2014 at 10:10 AM, Ranjib Dey dey.ranjib@gmail.com
wrote:

can be anywhere in you system. if its in arbitrary path, you have to
supply the entire path (without .rb extension) in require, if its anywhere
in $LOAD_PATH, then just the file name (without the .rb extension).

require ‘foo’ # if foo.rb is anywhere in $LOAD_PATH
require ‘/home/doug/foo’ # when /home/doug is outside $LOAD_PATH

cheers
ranjib

On Tue, Aug 19, 2014 at 9:56 AM, Douglas Garstang <
doug.garstang@gmail.com> wrote:

I’m trying to write a start handler. I’ve managed to get

start_handlers << Chef::Reporting::StartHandler.new()

into the client.rb file. Obviously, I need to change the details.
Now, I’m reading http://docs.getchef.com/handlers.html and under the
’Reporting’ section it talks about how to install the handler, but it
doesn’t say where the start_handler.rb file goes.

Does it go in a cookbook? This would seem to be a problem to me as
the handler needs to be deployed before chef runs.

Doug


Regards,

Douglas Garstang
http://www.linkedin.com/in/garstang
Email: doug.garstang@gmail.com
Cell: +1-805-340-5627


Regards,

Douglas Garstang
http://www.linkedin.com/in/garstang
Email: doug.garstang@gmail.com
Cell: +1-805-340-5627


Regards,

Douglas Garstang
http://www.linkedin.com/in/garstang
Email: doug.garstang@gmail.com
Cell: +1-805-340-5627


#8

On Tuesday, August 19, 2014 at 10:40 AM, Douglas Garstang wrote:

Ranjib,

You said that using chef_handler is not an idea solution. If we look at the alternatives, I still don’t understand where to put the files.
Anywhere on the filesystem. If you want to package it up and share it, then you can create a rubygem, but this is overkill for many use cases.

You mentioned a require statement. There’s no require statement in the client.rb file, so I don’t know where that’s supposed to go.

You add it yourself, at the top of the file.

If the files are present on the AMI before chef runs, I don’t know where to place these files. Documentation would be immensely helpful.

Douglas.
Docs with some examples:

http://docs.getchef.com/handlers.html#id2


Daniel DeLeo


#9

Someone should ban this guy from mailing list?

On Wed, Aug 20, 2014 at 5:43 AM, Daniel DeLeo dan@kallistec.com wrote:

On Tuesday, August 19, 2014 at 10:40 AM, Douglas Garstang wrote:

Ranjib,

You said that using chef_handler is not an idea solution. If we look at the alternatives, I still don’t understand where to put the files.
Anywhere on the filesystem. If you want to package it up and share it, then you can create a rubygem, but this is overkill for many use cases.

You mentioned a require statement. There’s no require statement in the client.rb file, so I don’t know where that’s supposed to go.

You add it yourself, at the top of the file.

If the files are present on the AMI before chef runs, I don’t know where to place these files. Documentation would be immensely helpful.

Douglas.
Docs with some examples:

http://docs.getchef.com/handlers.html#id2


Daniel DeLeo


#10

Hi Doug,

I’ve solved it like this:

https://github.com/TYPO3-cookbooks/etckeeper/blob/master/recipes/commit.rb#L34-L45

Yours
Steffen

On 19/08/14 18:56, Douglas Garstang wrote:

I’m trying to write a start handler. I’ve managed to get

start_handlers << Chef::Reporting::StartHandler.new()

into the client.rb file. Obviously, I need to change the details. Now, I’m
reading http://docs.getchef.com/handlers.html and under the 'Reporting’
section it talks about how to install the handler, but it doesn’t say where
the start_handler.rb file goes.

Does it go in a cookbook? This would seem to be a problem to me as the
handler needs to be deployed before chef runs.

Doug


#11

AJ,

We don’t really have a method or process for banning people from our
mailing list. This might be a good topic for discussion as part of the
Community Summits, part of our RFC process, and / or move the discussion to
another fourm.

Douglas, et. al,

What we do have are some published community guidelines on the docs site
http://docs.getchef.com/community_guidelines.html.

The guidelines include things like:

  • Be welcoming, friendly, and patient.
  • Be considerate.
  • Be respectful.
  • Be professional.
  • Be careful in the words that you choose.
  • When we disagree, let’s all work together to understand why.

Interacting with the community in a way that is outside of our community
guidelines is unacceptable.

Responses like "So it sounds like your basically saying this is a mess."
with seemingly little effort to understand the help that’s being offered is
disrespectful, unprofessional, and inconsiderate. It’s clear that you’re
struggling with trying to understand the way handlers work. It’s not clear
that you’re interested in working to understand how they work or try things
that will help.

The term for this type of interaction is “help vampire
http://www.skidmore.edu/~pdwyer/e/eoc/help_vampire.htm”. Douglas, you
are exhibiting some of the textbook behavior of a help vampire which is
going to lead to frustration for you and those who try to help you.
Eventually, your questions to the list will be ignored unless this
behavior improves. I don’t really think anyone wants that.

I am happy to discuss further with anyone at just about any time.

Thanks,
Nathen

On Tue, Aug 19, 2014 at 2:35 PM, AJ Christensen aj@junglist.io wrote:

Someone should ban this guy from mailing list?

On Wed, Aug 20, 2014 at 5:43 AM, Daniel DeLeo dan@kallistec.com wrote:

On Tuesday, August 19, 2014 at 10:40 AM, Douglas Garstang wrote:

Ranjib,

You said that using chef_handler is not an idea solution. If we look at
the alternatives, I still don’t understand where to put the files.
Anywhere on the filesystem. If you want to package it up and share it,
then you can create a rubygem, but this is overkill for many use cases.

You mentioned a require statement. There’s no require statement in the
client.rb file, so I don’t know where that’s supposed to go.

You add it yourself, at the top of the file.

If the files are present on the AMI before chef runs, I don’t know
where to place these files. Documentation would be immensely helpful.

Douglas.
Docs with some examples:

http://docs.getchef.com/handlers.html#id2


Daniel DeLeo


#12

Nathan you are awesome. Thanks for calling out the help vampire.

On Aug 19, 2014, at 12:48 PM, Nathen Harvey nharvey@getchef.com wrote:

AJ,

We don’t really have a method or process for banning people from our mailing list. This might be a good topic for discussion as part of the Community Summits, part of our RFC process, and / or move the discussion to another fourm.

Douglas, et. al,

What we do have are some published community guidelines on the docs site.

The guidelines include things like:
Be welcoming, friendly, and patient.
Be considerate.
Be respectful.
Be professional.
Be careful in the words that you choose.
When we disagree, let’s all work together to understand why.
Interacting with the community in a way that is outside of our community guidelines is unacceptable.

Responses like “So it sounds like your basically saying this is a mess.” with seemingly little effort to understand the help that’s being offered is disrespectful, unprofessional, and inconsiderate. It’s clear that you’re struggling with trying to understand the way handlers work. It’s not clear that you’re interested in working to understand how they work or try things that will help.

The term for this type of interaction is “help vampire”. Douglas, you are exhibiting some of the textbook behavior of a help vampire which is going to lead to frustration for you and those who try to help you. Eventually, your questions to the list will be ignored unless this behavior improves. I don’t really think anyone wants that.

I am happy to discuss further with anyone at just about any time.

Thanks,
Nathen

On Tue, Aug 19, 2014 at 2:35 PM, AJ Christensen aj@junglist.io wrote:
Someone should ban this guy from mailing list?

On Wed, Aug 20, 2014 at 5:43 AM, Daniel DeLeo dan@kallistec.com wrote:

On Tuesday, August 19, 2014 at 10:40 AM, Douglas Garstang wrote:

Ranjib,

You said that using chef_handler is not an idea solution. If we look at the alternatives, I still don’t understand where to put the files.
Anywhere on the filesystem. If you want to package it up and share it, then you can create a rubygem, but this is overkill for many use cases.

You mentioned a require statement. There’s no require statement in the client.rb file, so I don’t know where that’s supposed to go.

You add it yourself, at the top of the file.

If the files are present on the AMI before chef runs, I don’t know where to place these files. Documentation would be immensely helpful.

Douglas.
Docs with some examples:

http://docs.getchef.com/handlers.html#id2


Daniel DeLeo