FAQ
T
On Thursday, February 17, 2011 3:33:43 PM UTC-8, Bryan wrote:
I'm using puppet 0.25.1. I've got a simple resource: exec { "/bin/ls $oracle_base/dba/bin/database_backup.ksh": logoutput => on_failure, } and I don't want it to log every time it's successfully run: $ sudo tail -F /var/log/messages | grep puppetd Feb 17 16:36:11 test puppetd[26614]: (//my_module/Exec[/bin/ls /u01/ app/oracle/dba/bin/database_backup.ksh]/returns) executed successfully but logoutput => on_failure doesn't suppress the above message. Is that parameter not available in my version of puppet, or am I perhaps misunderstanding its purpose? I'm guessing the latter since it looks like it was introduced 3 years ago. In the meantime, I'm using this ugly, redundant hack to do what I want: exec { "/bin/ls $oracle_base/dba/bin/database_backup.ksh": unless => "/bin/ls $oracle_base/dba/bin/database_backup.ksh", } Thanks!
This is an old one, but I found it ALMOST useful. I'd like to take this one step further:

I have a subscribe statement on a service that requires a file. And, now I have the error on the non-existent file, it is still trying to run the service. I have tried every possible way to bypass this, even with an exec (file not found). Since the exec statement itself is "successful" (in not finding the file), it sill launches the service dependent on that file.
Finally, I really don't want errors to go to the client syslog... that is the whole reason why I want to do the checking first. To avoid errors in syslog when the service fails (for reason of a lacking patch... another issue: how to work with patching "if grep for patch; exists/not exists; optional run"). I'll keep looking but this lack of conditional services is painful.

file {'clientxml':
path => "/var/svc/manifest/network/sendmail-client.xml",
ensure => true,
backup => false,
noop => true,
loglevel => err,
}
service { "clientmail":
name => "sendmail-client:default",
manifest => "/var/svc/manifest/network/sendmail-client.xml",
provider => smf,
enable => true,
hasrestart => true,
require => File['clientxml']
}

Example:

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/KuU0kquGRWkJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Search Discussions

  • Jo Rhett at Aug 27, 2012 at 8:45 pm
    I think you are using the syntax wrong. Try to phrase your request in statements like "ensure this is true" instead of if/then case logic.

    ensure foo
    requires bar

    Also remember that the server doesn't know anything about the client, and the client's information is only collected once, and sent to the server from which a compiled catalog (with all if/thens resolved) is produced. So you can't have an if/then which is resolved at runtime.

    If you require a file, you will get a failure that the file exists or not. And an info message that service can't be dealt with since requirement failed. I think what you want to do is create a fact about whether the file exists or not, and then only define the service if the fact is true. Look up custom facts and you'll get there. Then your fact will be submitted, and the catalog will be revised based on the value of the fact -- which should meet your needs.
    On Aug 25, 2012, at 8:49 PM, mthebie99 wrote:
    On Thursday, February 17, 2011 3:33:43 PM UTC-8, Bryan wrote:
    I'm using puppet 0.25.1. I've got a simple resource: exec { "/bin/ls $oracle_base/dba/bin/database_backup.ksh": logoutput => on_failure, } and I don't want it to log every time it's successfully run: $ sudo tail -F /var/log/messages | grep puppetd Feb 17 16:36:11 test puppetd[26614]: (//my_module/Exec[/bin/ls /u01/ app/oracle/dba/bin/database_backup.ksh]/returns) executed successfully but logoutput => on_failure doesn't suppress the above message. Is that parameter not available in my version of puppet, or am I perhaps misunderstanding its purpose? I'm guessing the latter since it looks like it was introduced 3 years ago. In the meantime, I'm using this ugly, redundant hack to do what I want: exec { "/bin/ls $oracle_base/dba/bin/database_backup.ksh": unless => "/bin/ls $oracle_base/dba/bin/database_backup.ksh", } Thanks!
    This is an old one, but I found it ALMOST useful. I'd like to take this one step further:

    I have a subscribe statement on a service that requires a file. And, now I have the error on the non-existent file, it is still trying to run the service. I have tried every possible way to bypass this, even with an exec (file not found). Since the exec statement itself is "successful" (in not finding the file), it sill launches the service dependent on that file.
    Finally, I really don't want errors to go to the client syslog... that is the whole reason why I want to do the checking first. To avoid errors in syslog when the service fails (for reason of a lacking patch... another issue: how to work with patching "if grep for patch; exists/not exists; optional run"). I'll keep looking but this lack of conditional services is painful.

    file {'clientxml':
    path => "/var/svc/manifest/network/sendmail-client.xml",
    ensure => true,
    backup => false,
    noop => true,
    loglevel => err,
    }
    service { "clientmail":
    name => "sendmail-client:default",
    manifest => "/var/svc/manifest/network/sendmail-client.xml",
    provider => smf,
    enable => true,
    hasrestart => true,
    require => File['clientxml']
    }

    Example:

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/KuU0kquGRWkJ.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
    --
    Jo Rhett
    Net Consonance : net philanthropy to improve open source and internet projects.



    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Alison Lindberg at Aug 27, 2012 at 11:14 pm
    Thank you for replying, Jo ! And yes, the resultant errors (once I got the
    service dependency to actually fail when the file wasn't found) are also
    not desireable as its misleading and creates to much verbosity(and alarm
    for any admin seeing) in the client syslog. I will give it a try...albiet
    I probably won't have response to you for another week. This is something
    I had not tried. (The addition of a "require" statement didn't operate
    correctly either probably for reason you so noted).
    - alison -
    On Mon, Aug 27, 2012 at 1:44 PM, Jo Rhett wrote:

    I think you are using the syntax wrong. Try to phrase your request in
    statements like "ensure this is true" instead of if/then case logic.

    ensure foo
    requires bar

    Also remember that the server doesn't know anything about the client, and
    the client's information is only collected once, and sent to the server
    from which a compiled catalog (with all if/thens resolved) is produced. So
    you can't have an if/then which is resolved at runtime.

    If you require a file, you will get a failure that the file exists or not.
    And an info message that service can't be dealt with since requirement
    failed. I think what you want to do is create a fact about whether the file
    exists or not, and then only define the service if the fact is true. Look
    up custom facts and you'll get there. Then your fact will be submitted, and
    the catalog will be revised based on the value of the fact -- which should
    meet your needs.

    On Aug 25, 2012, at 8:49 PM, mthebie99 wrote:

    On Thursday, February 17, 2011 3:33:43 PM UTC-8, Bryan wrote:

    I'm using puppet 0.25.1. I've got a simple resource: exec { "/bin/ls
    $oracle_base/dba/bin/database_backup.ksh": logoutput => on_failure, } and I
    don't want it to log every time it's successfully run: $ sudo tail -F
    /var/log/messages | grep puppetd Feb 17 16:36:11 test puppetd[26614]:
    (//my_module/Exec[/bin/ls /u01/
    app/oracle/dba/bin/database_backup.ksh]/returns) executed successfully but
    logoutput => on_failure doesn't suppress the above message. Is that
    parameter not available in my version of puppet, or am I perhaps
    misunderstanding its purpose? I'm guessing the latter since it looks like
    it was introduced 3 years ago. In the meantime, I'm using this ugly,
    redundant hack to do what I want: exec { "/bin/ls
    $oracle_base/dba/bin/database_backup.ksh": unless => "/bin/ls
    $oracle_base/dba/bin/database_backup.ksh", } Thanks!


    This is an old one, but I found it ALMOST useful. I'd like to take this
    one step further:

    I have a subscribe statement on a service that requires a file. And, now I
    have the error on the non-existent file, it is still trying to run the
    service. I have tried every possible way to bypass this, even with an exec
    (file not found). Since the exec statement itself is "successful" (in not
    finding the file), it sill launches the service dependent on that file.
    Finally, I really don't want errors to go to the client syslog... that is
    the whole reason why I want to do the checking first. To avoid errors in
    syslog when the service fails (for reason of a lacking patch... another
    issue: how to work with patching "if grep for patch; exists/not exists;
    optional run"). I'll keep looking but this lack of conditional services is
    painful.

    file {'clientxml':
    path => "/var/svc/manifest/network/sendmail-client.xml",
    ensure => true,
    backup => false,
    noop => true,
    loglevel => err,
    }
    service { "clientmail":
    name => "sendmail-client:default",
    manifest => "/var/svc/manifest/network/sendmail-client.xml",
    provider => smf,
    enable => true,
    hasrestart => true,
    require => File['clientxml']
    }

    Example:

    --
    You received this message because you are subscribed to the Google Groups
    "Puppet Users" group.
    To view this discussion on the web visit
    https://groups.google.com/d/msg/puppet-users/-/KuU0kquGRWkJ.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to
    puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/puppet-users?hl=en.


    --
    Jo Rhett
    Net Consonance : net philanthropy to improve open source and internet
    projects.



    --
    You received this message because you are subscribed to the Google Groups
    "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to
    puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/puppet-users?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedAug 26, '12 at 5:17a
activeAug 27, '12 at 11:14p
posts3
users2
websitepuppetlabs.com

2 users in discussion

Alison Lindberg: 2 posts Jo Rhett: 1 post

People

Translate

site design / logo © 2022 Grokbase