Jira (PUP-2935) De-serializing resource title hashes from PSON raises an error under Ruby 1.8.7

2015-01-19 Thread Henrik Lindberg (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Henrik Lindberg commented on  PUP-2935 
 
 
 
 
 
 
 
 
 
 


 
 
 
 
 
 
  Re: De-serializing resource title hashes from PSON raises an error under Ruby 1.8.7  
 
 
 
 
 
 
 
 
 
 
From 4.0.0 (and in future parser in 3x) it is illegal to set a title to anything other than a string, (or an array of strings). The result is: 
 
 
 
 
 
 
Evaluation Error: Illegal title type at index 0. Expected String, got Hash[String, String]
 
 
 
 
 
 
 
Which is not a pretty error message as there is no reference to the source, there is at least now a check in place when a catalog is constructed from puppet language source. Directly feeding serialized catalogs produced via some other means is not a very good idea since these formats are intended for machine to machine communication where puppet is at both ends and they may thus lack in error handling / explanation of what is wrong etc. Also note that Ruby 1.8.7 is no longer supported from starting with Puppet 4.0.0. 
Closing this as won't fix, but will log a new ticket to improve the error message when using a title of the wrong type. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 


 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v6.3.10#6340-sha1:7ea293a) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
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 puppet-bugs+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-bugs@googlegroups.com.
Visit 

Jira (PUP-2935) De-serializing resource title hashes from PSON raises an error under Ruby 1.8.7

2015-01-15 Thread Henrik Lindberg (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Henrik Lindberg updated an issue 
 
 
 
 
 
 
 
 
 
 


 
 
 
 
 
 
 Puppet /  PUP-2935 
 
 
 
  De-serializing resource title hashes from PSON raises an error under Ruby 1.8.7  
 
 
 
 
 
 
 
 
 

Change By:
 
 Henrik Lindberg 
 
 
 

Scrum Team:
 
 Language 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 


 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v6.3.10#6340-sha1:7ea293a) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
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 puppet-bugs+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-bugs@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/d/optout.


Jira (PUP-2935) De-serializing resource title hashes from PSON raises an error under Ruby 1.8.7

2014-07-18 Thread Charlie Sharpsteen (JIRA)
Title: Message Title










 

 Charlie Sharpsteen commented on an issue


















  Re: De-serializing resource title hashes from PSON raises an error under Ruby 1.8.7 










Adrien Thebo: The intended use of passing an array to a resource definition is to create a bunch of resources that all share the same properties. For example: managing a list of files that all share the same owner and mode. In this case, the array should consist of simple strings that set the name for each resource.
In your case, you have an array of hashes that define many resources with possibly different properties. In this case, the last pattern mentioned that blog post, create_resources should be used. Instead of pulling variable values out of $name:



define threshold_to_check (
  ...
)
{
  $instance = $name['Instance']
  $type = $name['Type']
  $id = $name['id']
  ...
}



Make those variables full parameters of the type:



define threshold_to_check (
  $instance,
  $type,
  ...
)
{
  ...
}



The tricky bit is converting your array of hashes that contain id as an entry to a hash of hashes for create_resources. The following uses id as the new threshold name and is a bit gross as it round-trips through JSON to construct the hash of hashes:



if $threshold {
# Creates a hash of hashes using id as the top-level key.
$threshold_instances = parsejson(inline_template(% @threshold.map {|t| {\${monitorizacion::params::resourcehost}.${name}.${plugin}\ = t}}.to_json %))

$freshness_default_value = hiera('freshness_default_value',120)

create_resources(threshold_to_check, $thresholds, { 
  plugin = $plugin,
  vip_name = $vip_name,
  initial_state = inline_template(%= @initial_state || 'o' %),
  max_check_attempts = 1,
  active_checks_enabled = 0,
  passive_checks_enabled = 1,
  check_freshness = inline_template(%= @check_freshness || '1' %),
  freshness_threshold = inline_template(%= @freshness_threshold || @freshness_default_value %),
  obsess_over_service = $obsess_over_service,
  retain_status_information = $retain_status_information,
  retain_nonstatus_information = $retain_nonstatus_information,
  is_volatile = inline_template(%= @is_volatile || '1' %),
  command = check_dummy!0!\Reset to OK state automatically after ${freshness_default_value}s without new data\,
  # $command by default is check_nrpe
  eventhandler = $eventhandler,
}
  )



The new iteration constructs available in the future parser should provide a more elegant alternative to inline_template and parsejson.












   

Jira (PUP-2935) De-serializing resource title hashes from PSON raises an error under Ruby 1.8.7

2014-07-17 Thread Charlie Sharpsteen (JIRA)
Title: Message Title










 

 Charlie Sharpsteen updated an issue


















 Puppet /  PUP-2935



  De-serializing resource title hashes from PSON raises an error under Ruby 1.8.7 










Change By:

 Charlie Sharpsteen




Summary:

 ErrordeserializingJSONinCentOS De-serializingresourcetitlehashesfromPSONraisesanerrorunderRuby1.8.7












   

 Add Comment






















 This message was sent by Atlassian JIRA (v6.1.4#6159-sha1:44eaede)




 














-- 
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 puppet-bugs+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-bugs@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/d/optout.


Jira (PUP-2935) De-serializing resource title hashes from PSON raises an error under Ruby 1.8.7

2014-07-17 Thread adrian (JIRA)
Title: Message Title










 

 adrian commented on an issue


















  Re: De-serializing resource title hashes from PSON raises an error under Ruby 1.8.7 










These are the three manifest involved. https://gist.github.com/b9605efeab711ea2e1bc
The idea is pass a json to monitorizacion::checks::collectd params parameter. This json contains one array (Threshold), where the user could define several different thresholds. In ruby or other programming language I will use a loop to go over the array and generate each of the thresholds. As this is difficult in puppet I use the idea seen here: https://tobrunet.ch/2013/01/iterate-over-datastructures-in-puppet-manifests/ When a array is passed to a defined type, it is executed once per element.
Inside each threshold object there is another array, and the same strategy is used, sending to a defined type to go over all elements of the array.
Also I have to insert and id element to avoid duplicated resources (for example if two different thresholds have the same type with same parameters).
P.D.: any constructive criticism is welcome












   

 Add Comment

























 Puppet /  PUP-2935



  De-serializing resource title hashes from PSON raises an error under Ruby 1.8.7 







 With that environment, if I execute:  {code}  # puppet apply --catalog client1-catalog.json  Error: Could not run: Could not deserialize catalog from pson: Could not intern from pson: Could not intern from data: Could not find relationship target Notify[{\type\=\A\}]  {code}   If I execute in Ubuntu 14.04 with  Puppet 3.6.2  ruby-json 1.8.0-1build...