Issue #13212 has been updated by Jason Ashby.

I have this same issue on CentOS 6.4.  I'm defining an array of hashes.

    define foo() {
       notify{ $name['port']: }
       notify{ $name['device']: }
    }
    
    class test {
        $instances = [
          {'port' => 5487, 'device' =>'nfsa-7:/vol/pg002'}, 
          {'port' => 5488, 'device' =>'nfsa-7:/vol/pg092'},  
        ]
    
        foo{ $instances: }   
    }

puppet agent -t results in:

    Info: Retrieving plugin
    Info: Loading facts in /var/lib/puppet/lib/facter/position.rb
    Info: Loading facts in /var/lib/puppet/lib/facter/localusers.rb
    Info: Loading facts in /var/lib/puppet/lib/facter/datacenter.rb
    Info: Loading facts in /var/lib/puppet/lib/facter/root_home.rb
    Info: Loading facts in /var/lib/puppet/lib/facter/facter_dot_d.rb
    Info: Loading facts in /var/lib/puppet/lib/facter/backup.rb
    Info: Loading facts in /var/lib/puppet/lib/facter/in_dmz.rb
    Info: Loading facts in /var/lib/puppet/lib/facter/puppet_vardir.rb
    Info: Loading facts in /var/lib/puppet/lib/facter/vmwaretools_version.rb
    Info: Loading facts in /var/lib/puppet/lib/facter/meminbytes.rb
    Info: Loading facts in /var/lib/puppet/lib/facter/pe_version.rb
    Error: Could not retrieve catalog from remote server: Could not intern from 
text/pson: Could not convert from pson: Could not find relationship source 
"Foo[devicenfsa-7:/vol/pg092port5488]"
    Warning: Not using cache on failed catalog
    Error: Could not retrieve catalog; skipping run    

As others have stated, this happens intermittently.  Sometimes it works, 
sometimes if fails.  A successful run gives:

    Info: Retrieving plugin
    Info: Loading facts in /var/lib/puppet/lib/facter/position.rb
    Info: Loading facts in /var/lib/puppet/lib/facter/localusers.rb
    Info: Loading facts in /var/lib/puppet/lib/facter/datacenter.rb
    Info: Loading facts in /var/lib/puppet/lib/facter/root_home.rb
    Info: Loading facts in /var/lib/puppet/lib/facter/facter_dot_d.rb
    Info: Loading facts in /var/lib/puppet/lib/facter/backup.rb
    Info: Loading facts in /var/lib/puppet/lib/facter/in_dmz.rb
    Info: Loading facts in /var/lib/puppet/lib/facter/puppet_vardir.rb
    Info: Loading facts in /var/lib/puppet/lib/facter/vmwaretools_version.rb
    Info: Loading facts in /var/lib/puppet/lib/facter/meminbytes.rb
    Info: Loading facts in /var/lib/puppet/lib/facter/pe_version.rb
    Info: Caching catalog for bah.example.com
    Info: Applying configuration version '1383309957'
    Notice: 5488
    Notice: 
/Stage[main]/Test/Foo[devicenfsa-7:/vol/pg092port5488]/Notify[5488]/message: 
defined 'message' as '5488'
    Notice: 5487
    Notice: 
/Stage[main]/Test/Foo[devicenfsa-7:/vol/pg002port5487]/Notify[5487]/message: 
defined 'message' as '5487'
    Notice: nfsa-7:/vol/pg092
    Notice: 
/Stage[main]/Test/Foo[devicenfsa-7:/vol/pg092port5488]/Notify[nfsa-7:/vol/pg092]/message:
 defined 'message' as 'nfsa-7:/vol/pg092'
    Notice: nfsa-7:/vol/pg002
    Notice: 
/Stage[main]/Test/Foo[devicenfsa-7:/vol/pg002port5487]/Notify[nfsa-7:/vol/pg002]/message:
 defined 'message' as 'nfsa-7:/vol/pg002'
    Notice: Finished catalog run in 23.87 seconds


I've tried the following version combos, and all of them exhibit the same 
behavior:

puppet 3.1.1
ruby 1.8.7p352

puppet 3.1.1
ruby 1.9.3p448

puppet 3.3.1
ruby 1.9.3p448

puppet 3.3.1
ruby 1.8.7p352


I have not tried upgrading the master, which is currently running puppet 3.1.1. 
 Other data types I've tried in order to pass my data to my "foo" defined type 
are a hash of hashes and yaml.

The fix suggested by Johan to add "preferred_serialization_format = yaml" to 
puppet.conf results in an error with puppet 3.


----------------------------------------
Bug #13212: Pass array to custom define fails
https://projects.puppetlabs.com/issues/13212#change-99313

* Author: Juan José Presa Rodal
* Status: Needs More Information
* Priority: Normal
* Assignee: 
* Category: parser
* Target version: 
* Affected Puppet version: 
* Keywords: 
* Branch: 
----------------------------------------
I'm trying to pass a simple array to a custom define and fails with error:

`err: Could not retrieve catalog from remote server: Could not intern from 
pson: Could not convert from pson: Could not find relationship source 
"Foo::Map[idbazip2.2.2.2]"
`

I think that code is very correct:


`$foo = [{"id" => "bar", "ip" => "1.1.1.1"}, {"id" => "baz", "ip" => 
"2.2.2.2"}]`

`foo::map {$foo:}`

`define foo::map () {
  notify {$name['id']:
  }
}
`


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to