I''m trying to use hiera. The common.yaml is greg: db_type: "mysql" db_host: %{::domain} db_name: "odaigreg" db_user: "odaigreg" db_password: "odaigreg1" db_tag: "greg_db" is_remote: "true" and the command hiera -c /etc/puppet/environments/production/hiera.yaml greg environment=production confdir="/etc/puppet" -d returns: DEBUG: Mon Apr 29 15:11:48 +0200 2013: Hiera YAML backend starting DEBUG: Mon Apr 29 15:11:48 +0200 2013: Looking up greg in YAML backend DEBUG: Mon Apr 29 15:11:48 +0200 2013: Looking for data source common /usr/lib/ruby/site_ruby/1.8/hiera/filecache.rb:35:in `%'': malformed format string - %S (ArgumentError) from /usr/lib/ruby/site_ruby/1.8/hiera/filecache.rb:35:in `read'' from /usr/lib/ruby/site_ruby/1.8/hiera/backend/yaml_backend.rb:22:in `lookup'' from /usr/lib/ruby/site_ruby/1.8/hiera/backend.rb:68:in `datasources'' from /usr/lib/ruby/site_ruby/1.8/hiera/backend.rb:66:in `map'' from /usr/lib/ruby/site_ruby/1.8/hiera/backend.rb:66:in `datasources'' from /usr/lib/ruby/site_ruby/1.8/hiera/backend/yaml_backend.rb:16:in `lookup'' from /usr/lib/ruby/site_ruby/1.8/hiera/backend.rb:182:in `lookup'' from /usr/lib/ruby/site_ruby/1.8/hiera/backend.rb:179:in `each'' from /usr/lib/ruby/site_ruby/1.8/hiera/backend.rb:179:in `lookup'' from /usr/lib/ruby/site_ruby/1.8/hiera.rb:64:in `lookup'' from /usr/bin/hiera:220 The hiera.yaml is: :backends: yaml :yaml: :datadir: /etc/puppet/environments/production/hieradata :hierarchy: common :logger: console Any hints on something I missed? Thanks Luca -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
OK, solved!! The problem was the TAV character that notepad++ added to the hash. It seems that something in ruby does not like it (do not know ruby so...) If this is the correct behaviour there should be somewhere in the docs a warning for DO NOT USE TABS IN YAML file as it took quite asome time to find out. If is not a correct behaviour than is a bug :P Luca Il giorno lunedì 29 aprile 2013 15:15:05 UTC+2, Luca Gioppo ha scritto:> > I''m trying to use hiera. > > The common.yaml is > > > greg: > db_type: "mysql" > db_host: %{::domain} > db_name: "odaigreg" > db_user: "odaigreg" > db_password: "odaigreg1" > db_tag: "greg_db" > is_remote: "true" > > and the command > hiera -c /etc/puppet/environments/production/hiera.yaml greg > environment=production confdir="/etc/puppet" -d > > returns: > DEBUG: Mon Apr 29 15:11:48 +0200 2013: Hiera YAML backend starting > DEBUG: Mon Apr 29 15:11:48 +0200 2013: Looking up greg in YAML backend > DEBUG: Mon Apr 29 15:11:48 +0200 2013: Looking for data source common > /usr/lib/ruby/site_ruby/1.8/hiera/filecache.rb:35:in `%'': malformed format > string - %S (ArgumentError) > from /usr/lib/ruby/site_ruby/1.8/hiera/filecache.rb:35:in `read'' > from > /usr/lib/ruby/site_ruby/1.8/hiera/backend/yaml_backend.rb:22:in `lookup'' > from /usr/lib/ruby/site_ruby/1.8/hiera/backend.rb:68:in > `datasources'' > from /usr/lib/ruby/site_ruby/1.8/hiera/backend.rb:66:in `map'' > from /usr/lib/ruby/site_ruby/1.8/hiera/backend.rb:66:in > `datasources'' > from > /usr/lib/ruby/site_ruby/1.8/hiera/backend/yaml_backend.rb:16:in `lookup'' > from /usr/lib/ruby/site_ruby/1.8/hiera/backend.rb:182:in `lookup'' > from /usr/lib/ruby/site_ruby/1.8/hiera/backend.rb:179:in `each'' > from /usr/lib/ruby/site_ruby/1.8/hiera/backend.rb:179:in `lookup'' > from /usr/lib/ruby/site_ruby/1.8/hiera.rb:64:in `lookup'' > from /usr/bin/hiera:220 > > > The hiera.yaml is: > :backends: yaml > :yaml: > :datadir: /etc/puppet/environments/production/hieradata > :hierarchy: common > :logger: console > > Any hints on something I missed? > Thanks > Luca > >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Tabs are not allowed as indentation in yaml. They are allowed as whitespace. http://www.yaml.org/spec/1.2/spec.html#id2775170 http://www.yaml.org/spec/1.2/spec.html#id2777534 On Monday, April 29, 2013 7:07:55 AM UTC-7, Luca Gioppo wrote:> > OK, solved!! > The problem was the TAV character that notepad++ added to the hash. > It seems that something in ruby does not like it (do not know ruby so...) > > If this is the correct behaviour there should be somewhere in the docs a > warning for DO NOT USE TABS IN YAML file as it took quite asome time to > find out. > > If is not a correct behaviour than is a bug :P > Luca > > > Il giorno lunedì 29 aprile 2013 15:15:05 UTC+2, Luca Gioppo ha scritto: >> >> I''m trying to use hiera. >> >> The common.yaml is >> >> >> greg: >> db_type: "mysql" >> db_host: %{::domain} >> db_name: "odaigreg" >> db_user: "odaigreg" >> db_password: "odaigreg1" >> db_tag: "greg_db" >> is_remote: "true" >> >> and the command >> hiera -c /etc/puppet/environments/production/hiera.yaml greg >> environment=production confdir="/etc/puppet" -d >> >> returns: >> DEBUG: Mon Apr 29 15:11:48 +0200 2013: Hiera YAML backend starting >> DEBUG: Mon Apr 29 15:11:48 +0200 2013: Looking up greg in YAML backend >> DEBUG: Mon Apr 29 15:11:48 +0200 2013: Looking for data source common >> /usr/lib/ruby/site_ruby/1.8/hiera/filecache.rb:35:in `%'': malformed >> format string - %S (ArgumentError) >> from /usr/lib/ruby/site_ruby/1.8/hiera/filecache.rb:35:in `read'' >> from >> /usr/lib/ruby/site_ruby/1.8/hiera/backend/yaml_backend.rb:22:in `lookup'' >> from /usr/lib/ruby/site_ruby/1.8/hiera/backend.rb:68:in >> `datasources'' >> from /usr/lib/ruby/site_ruby/1.8/hiera/backend.rb:66:in `map'' >> from /usr/lib/ruby/site_ruby/1.8/hiera/backend.rb:66:in >> `datasources'' >> from >> /usr/lib/ruby/site_ruby/1.8/hiera/backend/yaml_backend.rb:16:in `lookup'' >> from /usr/lib/ruby/site_ruby/1.8/hiera/backend.rb:182:in `lookup'' >> from /usr/lib/ruby/site_ruby/1.8/hiera/backend.rb:179:in `each'' >> from /usr/lib/ruby/site_ruby/1.8/hiera/backend.rb:179:in `lookup'' >> from /usr/lib/ruby/site_ruby/1.8/hiera.rb:64:in `lookup'' >> from /usr/bin/hiera:220 >> >> >> The hiera.yaml is: >> :backends: yaml >> :yaml: >> :datadir: /etc/puppet/environments/production/hieradata >> :hierarchy: common >> :logger: console >> >> Any hints on something I missed? >> Thanks >> Luca >> >>-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
This happens when one doesn''t study all specs around :D Thanks. Luca -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.