# 1. able to see confirm pluginsync = true works
$ find /var/lib/puppet/lib/puppet/ -type f
/var/lib/puppet/lib/puppet/type/custominstall.rb
/var/lib/puppet/lib/puppet/provider/custominstall/custominstall.rb

# 2. but I still get the following messages
$ sudo less /var/log/messags
May 23 17:45:20 dashboard puppet-agent[29951]: (/Stage[main]//
Node[dashboard.lab.xxx.net]/Custominstall[erlgrey]) Could not
evaluate: No ability to determine if custominstall exists

# my site.pp for the node is simple
$ cat /etc/puppet/manifests/site.pp
node 'dashboard.lab.xxx.net' {
  custominstall { "erlgrey":
    ensure  => present,
    release => "1551",
  }
}

# here is the type
$ cat /etc/puppet/modules/xxx/lib/puppet/type/custominstall.rb

Puppet::Type.newtype(:custominstall) do
  @doc = "Manage custominstall"

    feature :installable, "The provider can install packages.",
      :methods => [:install]
    feature :uninstallable, "The provider can uninstall packages.",
      :methods => [:uninstall]

    ensurable do
      desc "What state the package should be in
[absent,present,installed]."

      newvalue(:present, :event => :package_installed) do
        provider.install
      end

      newvalue(:absent, :event => :package_removed) do
        provider.uninstall
      end

      # Alias the 'present' value.
      aliasvalue(:installed, :present)

      defaultto :installed
    end

    newparam(:artifact, :namevar => true) do
      desc "The package name."
    end

    newparam(:revision) do
      desc "The package revision."
    end
end

# here is the provider
$ cat /etc/puppet/modules/xxx/lib/puppet/provider/custominstall/
custominstall.rb
Puppet::Type.type(:custominstall).provide :custominstall do
  commands :curl        => "/usr/bin/curl"

  def uninstall
    notice "going to uninstall #{@resource[:name]}"
  end

  def install
    artifact = @resource[:name]
    file = "/tmp/#{artifact}.xml"
    url = "http://xxx/#{@resource[:revision]}";
    Puppet::Util::SUIDManager.asuser("xxx", "xxx") do
      curl "-o", file, "-C", "-", "-k", "-s", "--url", url
    end
  end
end


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

Reply via email to