FAQ
Hi pupper community,

I am working with puppet on Windows and have an issue.
I want to check what version of a package is installed.
My idea was to add a file in the package package28112012.txt and while
running the manifest check if that package28112012.txt exists on the agent?
Can I define a variable reading this filename on the master?

Regards and thanks in advance,

Romain

--
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/-/tuum3dQXrYoJ.
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

  • Eduardo A Muñoz at Nov 28, 2012 at 8:09 pm
    I think you would want to create a fact that publish that state to the
    master.
    On Wed, Nov 28, 2012 at 3:26 PM, Romain Gales wrote:

    Hi pupper community,

    I am working with puppet on Windows and have an issue.
    I want to check what version of a package is installed.
    My idea was to add a file in the package package28112012.txt and while
    running the manifest check if that package28112012.txt exists on the agent?
    Can I define a variable reading this filename on the master?

    Regards and thanks in advance,

    Romain

    --
    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/-/tuum3dQXrYoJ.
    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.
  • Romain Gales at Nov 28, 2012 at 8:52 pm
    there is what i tried:

    # getpfoleproxyver.rb
    #
    Facter.add(:getpfoleproxyver) do
    setcode do
    Facter::Util::Resolution.exec('basename `ls
    /softw4pc/Misc/pfoleproxy/pfoleproxy*.txt`')
    end
    end

    the fact is working fine, but how to use this in my manifest?
    i tried a lot but it was always empty?

    $getpfoleproxyver should be correct, no?


    On Wednesday, 28 November 2012 21:09:40 UTC+1, showy wrote:

    I think you would want to create a fact that publish that state to the
    master.

    On Wed, Nov 28, 2012 at 3:26 PM, Romain Gales <romain...@gmail.com<javascript:>
    wrote:
    Hi pupper community,

    I am working with puppet on Windows and have an issue.
    I want to check what version of a package is installed.
    My idea was to add a file in the package package28112012.txt and while
    running the manifest check if that package28112012.txt exists on the agent?
    Can I define a variable reading this filename on the master?

    Regards and thanks in advance,

    Romain

    --
    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/-/tuum3dQXrYoJ.
    To post to this group, send email to puppet...@googlegroups.com<javascript:>
    .
    To unsubscribe from this group, send email to
    puppet-users...@googlegroups.com <javascript:>.
    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 view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/XuJnHGC4BHYJ.
    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.
  • Jakov Sosic at Dec 13, 2012 at 12:29 am

    On 11/28/2012 09:46 PM, Romain Gales wrote:
    there is what i tried:

    # getpfoleproxyver.rb
    #
    Facter.add(:getpfoleproxyver) do
    setcode do
    Facter::Util::Resolution.exec('basename `ls
    /softw4pc/Misc/pfoleproxy/pfoleproxy*.txt`')
    end
    end

    the fact is working fine, but how to use this in my manifest?
    i tried a lot but it was always empty?

    $getpfoleproxyver should be correct, no?
    Are you sure it's working on the client? You can see the value when you
    type facter -p | grep getpfoleproxyver

    ?

    --
    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.
  • Romain Gales at Dec 13, 2012 at 6:46 am
    The facter should be executed on the server instead on the client.



    On Thursday, December 13, 2012 1:29:23 AM UTC+1, Jakov Sosic wrote:
    On 11/28/2012 09:46 PM, Romain Gales wrote:
    there is what i tried:

    # getpfoleproxyver.rb
    #
    Facter.add(:getpfoleproxyver) do
    setcode do
    Facter::Util::Resolution.exec('basename `ls
    /softw4pc/Misc/pfoleproxy/pfoleproxy*.txt`')
    end
    end

    the fact is working fine, but how to use this in my manifest?
    i tried a lot but it was always empty?

    $getpfoleproxyver should be correct, no?
    Are you sure it's working on the client? You can see the value when you
    type facter -p | grep getpfoleproxyver

    ?
    --
    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/-/7cJYuX2oy2YJ.
    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.
  • Luke Bigum at Dec 13, 2012 at 10:26 am
    Romain, I am confused.

    In your first post you said you need to check if a package exists on the
    "Agent", the Puppet client.

    Now below you say you need the check executed on the Master.

    Facts are executed on the Agents and only ever on Agents. If you want to
    check for something on a client/agent machine, you use a Fact, like the one
    you posted below.

    If you want to execute arbitrary code on the Master (during catalogue
    compilation) probably the simplest thing you are after is the Generate
    function:

    http://docs.puppetlabs.com/references/latest/function.html#generate

    On linux, I would use something that looks a bit like this:

    class woof {
    $file_exists = generate('/bin/test', '-f',
    '/softw4pc/Misc/pfoleproxy/pfoleproxy*.txt')
    if $file_exists {
    ...
    }
    }

    There are other ways you can execute arbitrary code, like embedded Ruby
    with the inline_template() function, pure Ruby manifests, or bury the code
    somehow in a custom type and provider.

    Does that help?

    -Luke
    On Thursday, December 13, 2012 6:46:07 AM UTC, Romain Gales wrote:

    The facter should be executed on the server instead on the client.



    On Thursday, December 13, 2012 1:29:23 AM UTC+1, Jakov Sosic wrote:
    On 11/28/2012 09:46 PM, Romain Gales wrote:
    there is what i tried:

    # getpfoleproxyver.rb
    #
    Facter.add(:getpfoleproxyver) do
    setcode do
    Facter::Util::Resolution.exec('basename `ls
    /softw4pc/Misc/pfoleproxy/pfoleproxy*.txt`')
    end
    end

    the fact is working fine, but how to use this in my manifest?
    i tried a lot but it was always empty?

    $getpfoleproxyver should be correct, no?
    Are you sure it's working on the client? You can see the value when you
    type facter -p | grep getpfoleproxyver

    ?
    --
    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/-/zrpJgZzE8poJ.
    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.
  • Romain Gales at Dec 13, 2012 at 3:58 pm
    Hi,

    I malformed my question.
    This is a hint in the right direction.


    Romain

    On Thursday, 13 December 2012 11:26:20 UTC+1, Luke Bigum wrote:

    Romain, I am confused.

    In your first post you said you need to check if a package exists on the
    "Agent", the Puppet client.

    Now below you say you need the check executed on the Master.

    Facts are executed on the Agents and only ever on Agents. If you want to
    check for something on a client/agent machine, you use a Fact, like the one
    you posted below.

    If you want to execute arbitrary code on the Master (during catalogue
    compilation) probably the simplest thing you are after is the Generate
    function:

    http://docs.puppetlabs.com/references/latest/function.html#generate

    On linux, I would use something that looks a bit like this:

    class woof {
    $file_exists = generate('/bin/test', '-f',
    '/softw4pc/Misc/pfoleproxy/pfoleproxy*.txt')
    if $file_exists {
    ...
    }
    }

    There are other ways you can execute arbitrary code, like embedded Ruby
    with the inline_template() function, pure Ruby manifests, or bury the code
    somehow in a custom type and provider.

    Does that help?

    -Luke
    On Thursday, December 13, 2012 6:46:07 AM UTC, Romain Gales wrote:

    The facter should be executed on the server instead on the client.



    On Thursday, December 13, 2012 1:29:23 AM UTC+1, Jakov Sosic wrote:
    On 11/28/2012 09:46 PM, Romain Gales wrote:
    there is what i tried:

    # getpfoleproxyver.rb
    #
    Facter.add(:getpfoleproxyver) do
    setcode do
    Facter::Util::Resolution.exec('basename `ls
    /softw4pc/Misc/pfoleproxy/pfoleproxy*.txt`')
    end
    end

    the fact is working fine, but how to use this in my manifest?
    i tried a lot but it was always empty?

    $getpfoleproxyver should be correct, no?
    Are you sure it's working on the client? You can see the value when you
    type facter -p | grep getpfoleproxyver

    ?
    --
    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/-/au5MT1bWYxcJ.
    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
postedNov 28, '12 at 8:04p
activeDec 13, '12 at 3:58p
posts7
users4
websitepuppetlabs.com

People

Translate

site design / logo © 2022 Grokbase