Run this only once!!

3,366 views
Skip to first unread message

vella1tj

unread,
Jul 12, 2011, 4:19:34 PM7/12/11
to Puppet Users
Hi, I am trying run a package once and when it completes I want my
manifest to create a touch file and from that file being placed there
it will not run again. I have this so far, but have been running into
syntax problems/invalid parameters.


#Package to install
package { 'Bindscript20100601.dmg':
provider => pkgdmg,
ensure => installed,
source => 'temp/location/rightnow/Bindscript20100601.dmg',
notify => [Exec['blahblah']],
onlyif => "test -e /var/db/.bindscript",
}
exec {'blahblah':
command =>'touch /var/db/.bindscript',
path =>['/usr/bin']
}

If you need more information please ask.

Jacob Helwig

unread,
Jul 12, 2011, 4:37:46 PM7/12/11
to puppet...@googlegroups.com

Couple of things.

onlyif is only valid on exec resources.

This shouldn't actually be necessary. The pkgdmg provider should keep
track of which things it's installed, so it won't keep trying to install
the .dmg on every run.

Is the following resource definition not working for you?

package { 'Bindscript20100601.dmg':
provider => pkgdmg,
ensure => installed,
source => 'temp/location/rightnow/Bindscript20100601.dmg',
}

--
Jacob Helwig
,----
| Join us for PuppetConf, September 22nd and 23rd in Portland, OR
| http://bit.ly/puppetconfsig
`----

signature.asc

vella1tj

unread,
Jul 12, 2011, 4:43:45 PM7/12/11
to puppet...@googlegroups.com
package { 'Bindscript20100601.dmg':
     provider => pkgdmg,
     ensure   => installed,
     source   => 'temp/location/rightnow/Bindscript20100601.dmg',
  } 

Seems to work fine I return this once it runs "notice: //Package[Bindscript20100601.pkg.dmg]/ensure: created"

So it will only run once on the machine?

Nigel Kersten

unread,
Jul 12, 2011, 4:54:10 PM7/12/11
to puppet...@googlegroups.com
On Tue, Jul 12, 2011 at 1:37 PM, Jacob Helwig <ja...@puppetlabs.com> wrote:

This shouldn't actually be necessary.  The pkgdmg provider should keep
track of which things it's installed, so it won't keep trying to install
the .dmg on every run.


and for further detail, due to OS X not having a real package management system, the way Puppet works out if a package was installed is by dropping a .puppet_pkgdmg_.... file in /var/db

 

Jacob Helwig

unread,
Jul 12, 2011, 5:00:14 PM7/12/11
to puppet...@googlegroups.com

Correct. As long as the file that Nigel pointed out remains there, it
won't try to install the .dmg again.

signature.asc

vella1tj

unread,
Jul 15, 2011, 10:23:08 AM7/15/11
to Puppet Users
After I ran that manifest, with this only

#Package to install
package { 'Bindscript20100601.dmg':
provider => pkgdmg,
ensure => installed,
source => '/etc/puppet/bindscript/files/
Bindscript20100601.dmg',


I am now receiving these errors and on the second error,
Bindscript.dmg disappears as if it's deleting itself. I've created the
dmg in disk utility in Mac osx.

vella1tj

unread,
Jul 15, 2011, 10:34:35 AM7/15/11
to Puppet Users
the errors are:

err: //Package[Bindscript20100601.dmg]/ensure: change from absent to
present failed: Execution of '/usr/bin/hdiutil mount -plist -nobrowse -
readonly -noidme -mountrandom /tmp /Users/vella1tj/Desktop/
Bindscript2010601.dmg' returned 1: hdiutil: mount failed - Resource
temporarily unavailable

notice: //Exec[blahblah]: Dependency package[Bindscript20100601.dmg]
has 1 failures
warning: //Exec[blahblah]: Skipping because of failed dependencies

Nigel Kersten

unread,
Jul 17, 2011, 12:52:56 AM7/17/11
to puppet...@googlegroups.com
On Fri, Jul 15, 2011 at 7:34 AM, vella1tj <vell...@gmail.com> wrote:
> the errors are:
>
> err: //Package[Bindscript20100601.dmg]/ensure: change from absent to
> present failed: Execution of '/usr/bin/hdiutil mount -plist -nobrowse -
> readonly -noidme -mountrandom /tmp /Users/vella1tj/Desktop/
> Bindscript2010601.dmg' returned 1: hdiutil: mount failed - Resource
> temporarily unavailable

Can you download the dmg and mount it using the same command?

That looks like either a corrupt dmg or a (possibly temporary) issue
with the disk mounting framework to me.

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

--
Nigel Kersten
Product Manager, Puppet Labs

Join us for PuppetConf
<http://www.bit.ly/puppetconfsig>
Sept 22/23 Portland, Oregon, USA.

Reply all
Reply to author
Forward
0 new messages