Re: [Puppet Users] using ruby dsl in puppet manifest

2014-05-12 Thread Ritesh Nanda
Hello John,

I made a mistake in writing , i am using exec resource to execute that
script.

Regards,
Ritesh


On Mon, May 12, 2014 at 7:05 AM, jcbollinger wrote:

>
>
> On Saturday, May 10, 2014 7:49:18 PM UTC-5, Ritesh Nanda wrote:
>>
>> Hello John,
>>
>> Thanks for your reply , ruby code i was trying to run was on client , so
>> i am doing with inline_template right now , yeah but your idea seems good
>> to have a plugin to do it .
>>
>
>
> A plugin or an Exec is the *only* place to do it.  As I wrote, templates
> are evaluated on the master, so *inline_template() will not do what you
> want*.  If your code must run on the agent then it must be in a custom
> fact or in the provider of a custom type, it must be run via an Exec
> resource.
>
>
> John
>
>   --
> You received this message because you are subscribed to a topic in the
> Google Groups "Puppet Users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/puppet-users/3lD1tChZQJw/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> puppet-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/753fb5f8-0394-4be7-9a64-9d2a8fcc6ecf%40googlegroups.com
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 


* With Regards  *


* Ritesh Nanda*


 

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAO5CbpAsD%3D74cACwoMm32fCb-P9%2B2JC5SxAooR4OJ66iB6umNg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] using ruby dsl in puppet manifest

2014-05-12 Thread jcbollinger


On Saturday, May 10, 2014 7:49:18 PM UTC-5, Ritesh Nanda wrote:
>
> Hello John,
>
> Thanks for your reply , ruby code i was trying to run was on client , so i 
> am doing with inline_template right now , yeah but your idea seems good to 
> have a plugin to do it .
>


A plugin or an Exec is the *only* place to do it.  As I wrote, templates 
are evaluated on the master, so *inline_template() will not do what you 
want*.  If your code must run on the agent then it must be in a custom fact 
or in the provider of a custom type, it must be run via an Exec resource.


John

 

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/753fb5f8-0394-4be7-9a64-9d2a8fcc6ecf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] using ruby dsl in puppet manifest

2014-05-10 Thread Ritesh Nanda
Hello John,

Thanks for your reply , ruby code i was trying to run was on client , so i
am doing with inline_template right now , yeah but your idea seems good to
have a plugin to do it .

I would start thinking on it , thanks for your help.

Regards,
Ritesh


On Fri, May 9, 2014 at 11:46 AM, jcbollinger wrote:

>
>
> On Thursday, May 8, 2014 12:36:56 PM UTC-5, Ritesh Nanda wrote:
>>
>> Thanks Henrik ,
>>
>> I would like to find a file and  parse it  , so that would be on the
>> agent , creating a puppet function would not work , as master  will not be
>> able to access those files.
>>
>
>
> Neither would anything written in Ruby DSL, for much the same reason.
>
>
>
>> You said Can be done with Resources , how can i include a ruby block in
>> my manifest , i know using exec resource i can run a ruby script , but any
>> better way to do it.
>>
>>
>
> You can execute more or less arbitrary Ruby code from your manifest via an
> ERB template, using the built-in template() or inline_template() function.
> You can serve some purposes for which you might want Ruby by enabling and
> using the 'future' parser.  But all of that runs on the master, in order to
> build a "catalog" describing the resources and properties to manage on the
> target node.
>
> If you want to run custom Ruby code on the client as part of a Puppet run
> then you must build a 
> pluginwith
>  which Puppet (or Facter) will do so.  If the purpose is to gather
> information to inform catalog construction, then your plugin should be a 
> custom
> fact .  If the
> purpose is to modify the system then you want a custom resource type and
> a provider for it .
>
>
> John
>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "Puppet Users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/puppet-users/3lD1tChZQJw/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> puppet-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/c92d012d-99c6-4de3-b74e-44beda2e3622%40googlegroups.com
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 


* With Regards  *


* Ritesh Nanda*


 

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAO5CbpAdX4mpR_%3DEQQ%2BoiF3Snt8eTCcpFkU2pZdHF%2BetLRmMyQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] using ruby dsl in puppet manifest

2014-05-09 Thread jcbollinger


On Thursday, May 8, 2014 12:36:56 PM UTC-5, Ritesh Nanda wrote:
>
> Thanks Henrik ,
>
> I would like to find a file and  parse it  , so that would be on the agent 
> , creating a puppet function would not work , as master  will not be able 
> to access those files.
>


Neither would anything written in Ruby DSL, for much the same reason.

 

> You said Can be done with Resources , how can i include a ruby block in my 
> manifest , i know using exec resource i can run a ruby script , but any 
> better way to do it.
>
>

You can execute more or less arbitrary Ruby code from your manifest via an 
ERB template, using the built-in template() or inline_template() function.  
You can serve some purposes for which you might want Ruby by enabling and 
using the 'future' parser.  But all of that runs on the master, in order to 
build a "catalog" describing the resources and properties to manage on the 
target node.

If you want to run custom Ruby code on the client as part of a Puppet run 
then you must build a 
pluginwith
 which Puppet (or Facter) will do so.  If the purpose is to gather 
information to inform catalog construction, then your plugin should be a custom 
fact .  If the purpose 
is to modify the system then you want a custom resource type and a provider 
for it .


John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/c92d012d-99c6-4de3-b74e-44beda2e3622%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] using ruby dsl in puppet manifest

2014-05-09 Thread Ritesh Nanda
Hello Henrik ,

Thanks for your reply , i was also thinking to create a type and provider
using existing parser functionality  puppet has . Even thanks for sharing
those links , it was helpful.

Regards,
Ritesh Nanda




On Thu, May 8, 2014 at 7:17 PM, Henrik Lindberg <
henrik.lindb...@cloudsmith.com> wrote:

> On 2014-08-05 19:36, Ritesh Nanda wrote:
>
>> Thanks Henrik ,
>>
>> I would like to find a file and  parse it  , so that would be on the
>> agent , creating a puppet function would not work , as master  will not
>> be able to access those files.
>> You said Can be done with Resources , how can i include a ruby block in
>> my manifest , i know using exec resource i can run a ruby script , but
>> any better way to do it.
>>
>>  Depends on what you are parsing, and what you need to do with the parsed
> result. You may find that there is already a module that does what you
> want.
>
> Basically, the logic that does that has to be an implementation of a
> resource type. That is what is responsible for syncing the state of the
> agent where it is running with what is on that agent. It gets what was
> specified in the manifests in a resource, and the provider logic for that
> resource type then does the sync.
>
> That is how all resource types / providers work.
>
> This may help you: http://doauto.wordpress.com/2013/06/22/how-to-change-a-
> file-using-puppet/
>
> And you have Augeas where you can write "lenses" (plugins) to Augeas to
> handle specific syntax.
>
> http://docs.puppetlabs.com/guides/augeas.html#loading-
> generic-lenses-for-non-standard-files
>
> http://bombasticmonkey.com/2011/01/02/distributing-
> augeas-lenses-with-pluginsync/
>
> Hope that helps.
> - henrik
>
>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Puppet Users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/puppet-users/3lD1tChZQJw/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> puppet-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/puppet-users/lkhabk%24uj1%241%40ger.gmane.org.
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 


* With Regards  *


* Ritesh Nanda*


 

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAO5CbpAbjoMAH_HHPieAJPakYti3oizbSGEk81TmtO8dbm1QGw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] using ruby dsl in puppet manifest

2014-05-08 Thread Henrik Lindberg

On 2014-08-05 19:36, Ritesh Nanda wrote:

Thanks Henrik ,

I would like to find a file and  parse it  , so that would be on the
agent , creating a puppet function would not work , as master  will not
be able to access those files.
You said Can be done with Resources , how can i include a ruby block in
my manifest , i know using exec resource i can run a ruby script , but
any better way to do it.


Depends on what you are parsing, and what you need to do with the parsed
result. You may find that there is already a module that does what you want.

Basically, the logic that does that has to be an implementation of a 
resource type. That is what is responsible for syncing the state of the 
agent where it is running with what is on that agent. It gets what was 
specified in the manifests in a resource, and the provider logic for 
that resource type then does the sync.


That is how all resource types / providers work.

This may help you: 
http://doauto.wordpress.com/2013/06/22/how-to-change-a-file-using-puppet/


And you have Augeas where you can write "lenses" (plugins) to Augeas to 
handle specific syntax.


http://docs.puppetlabs.com/guides/augeas.html#loading-generic-lenses-for-non-standard-files

http://bombasticmonkey.com/2011/01/02/distributing-augeas-lenses-with-pluginsync/

Hope that helps.
- henrik


--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/lkhabk%24uj1%241%40ger.gmane.org.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] using ruby dsl in puppet manifest

2014-05-08 Thread Ritesh Nanda
Thanks Henrik ,

I would like to find a file and  parse it  , so that would be on the agent
, creating a puppet function would not work , as master  will not be able
to access those files.
You said Can be done with Resources , how can i include a ruby block in my
manifest , i know using exec resource i can run a ruby script , but any
better way to do it.


Regards,
Ritesh




On Thu, May 8, 2014 at 11:16 AM, Henrik Lindberg <
henrik.lindb...@cloudsmith.com> wrote:

> On 2014-08-05 19:03, Ritesh Nanda wrote:
>
>> Hello ,
>>
>> I would like to use ruby dsl in my manifest . Online doc for this topic
>> is very limited , i am stuck at a place where i want to use ruby DIr
>> class to find a particular file in a directory and then run operation on
>> it .
>> Is it possible to use  ruby dsl for puppet in this way.
>>
>>  The ruby DSL is deprecated and will be removed in Puppet 4.
>
> What you want is probably to write a function in Ruby.
> The deprecated Ruby DSL was a way to write manifests in .rb files instead
> of .pp files.
>
> If what you want to do is something that executes on the master side, you
> implement it as a function. If it is something that should run on the
> agent, it is implemented as a resource type.
>
> Regards
> - henrik
>
>
>> Regards,
>> Ritesh Nanda
>>
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Puppet Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send
>> an email to puppet-users+unsubscr...@googlegroups.com
>> .
>>
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/puppet-users/fcb75cd4-
>> 68fa-4ed6-93a0-596d175f87fe%40googlegroups.com
>> > 68fa-4ed6-93a0-596d175f87fe%40googlegroups..com?utm_
>> medium=email&utm_source=footer>.
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Puppet Users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/puppet-users/3lD1tChZQJw/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> puppet-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/puppet-users/lkge4q%24tb1%241%40ger.gmane.org.
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 


* With Regards  *


* Ritesh Nanda*


 

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAO5CbpD%3D%2Bu7qrbNAzrQ3W8x2jUK1ysHkXLOaUZS3FfDbqQB%2BhQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] using ruby dsl in puppet manifest

2014-05-08 Thread Henrik Lindberg

On 2014-08-05 19:03, Ritesh Nanda wrote:

Hello ,

I would like to use ruby dsl in my manifest . Online doc for this topic
is very limited , i am stuck at a place where i want to use ruby DIr
class to find a particular file in a directory and then run operation on
it .
Is it possible to use  ruby dsl for puppet in this way.


The ruby DSL is deprecated and will be removed in Puppet 4.

What you want is probably to write a function in Ruby.
The deprecated Ruby DSL was a way to write manifests in .rb files 
instead of .pp files.


If what you want to do is something that executes on the master side, 
you implement it as a function. If it is something that should run on 
the agent, it is implemented as a resource type.


Regards
- henrik



Regards,
Ritesh Nanda


--
You received this message because you are subscribed to the Google
Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to puppet-users+unsubscr...@googlegroups.com
.
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/fcb75cd4-68fa-4ed6-93a0-596d175f87fe%40googlegroups.com
.
For more options, visit https://groups.google.com/d/optout.



--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/lkge4q%24tb1%241%40ger.gmane.org.
For more options, visit https://groups.google.com/d/optout.