Custom Type & Invalid Parameter...

274 views
Skip to first unread message

Gavin Williams

unread,
Nov 7, 2012, 5:46:55 AM11/7/12
to puppet...@googlegroups.com
Hi All

As per my various other Posts, I'm writing a customer type and provider set for NetApp support..

My current problem is that the 'puppet device -v' run keeps failing with:

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Invalid parameter aggregate at /etc/puppet/manifests/site.pp:30 on node actint-star-nactl01

Now as far as I can see, the parameter is defined correctly in the manifest and the type:
Manifest:
        # Test NetApp volume provider
        netapp_volume { 'v_puppet_test':
                ensure => present,
                initsize => "1g",
                aggregate => "aggr01",
                spaceres => "none",
        }

 Type:
Puppet::Type.newtype(:netapp_volume) do
  @doc = "Manage Netapp Volume creation, modification and deletion."

  apply_to_device

  ensurable do
    desc "Netapp Volume resource state. Valid values are: present, absent."

    defaultto(:present)

    newvalue(:present) do
      provider.create
    end

    newvalue(:absent) do
      provider.destroy
    end
  end

  newparam(:name) do
    desc "The volume name."
    isnamevar
  end

  newparam(:initsize) do
    desc "The initial volume size."
    defaultto "1g"
  end

  newparam(:aggregate) do
    desc "The aggregate this volume should be created in."
  end

  newparam(:spaceres) do
    desc "The space reservation mode."
  end
end

 Provider does some debugging logging within the create and exists? as follows:
... 
def create
    Puppet.debug("Puppet::Provider::Netapp_volume: creating Netapp Volume #{@resource[:name]} of initial size #{@resource[:initsize]} in Aggregate #{@resource[:aggregate]} using space reserve of #{@resource[:spaceres]}.")
..
  def exists?
    Puppet.debug("Puppet::Provider::Netapp_volume: checking existance of Netapp Volume #{@resource[:name]}")
    result = transport.invoke("volume-list-info", "volume", @resource[:name])
    Puppet.debug("Puppet::Provider::Netapp_volume: Vol Info: " + result.sprintf() + "\n")
    if(result.results_status == "failed")
      Puppet.debug("Puppet::Provider::Netapp_volume: Volume doesn't currently exist. \n")
      return false
    else
      Puppet.debug("Puppet::Provider::Netapp_volume: Volume already exists. \n")
      return true
    end

  end
...

When running puppet device in debug mode, get the following log entries:

^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume: checking existance of Netapp Volume v_puppet_test
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume: Vol Info: <results status="failed" reason="No volume named 'v_puppet_test' exists" errno="13040"></results>

^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume: Volume doesn't currently exist.
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume: creating Netapp Volume v_puppet_test of initial size 1g in Aggregate  using space reserve of .

So I'm seeing values against name and initsize params, but not against aggregate or spaceres...

Any ideas???

Cheers
Gavin

PS: Full Git code is available here: https://github.com/fatmcgav/fatmcgav-netapp

Gavin Williams

unread,
Nov 7, 2012, 7:04:14 AM11/7/12
to puppet...@googlegroups.com
Hmm... It seems that all that was needed was a Puppetmaster restart :s

Now happily creating volumes...

Cheers
Gavin

Jakov Sosic

unread,
Dec 18, 2012, 8:28:13 PM12/18/12
to puppet...@googlegroups.com
On 11/07/2012 01:04 PM, Gavin Williams wrote:
> Hmm... It seems that all that was needed was a Puppetmaster restart :s
>
> Now happily creating volumes...

Yeah you should restart puppetmaster every time you change your custom
type. I'm not sure though if it's necessary after making changes to
provider.



--
Jakov Sosic
www.srce.unizg.hr
Reply all
Reply to author
Forward
0 new messages