Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: hiera/puppet_node_classifier.rb

Issue 29324518: Issue 2944 - Ensure the ENC being executed with the native Ruby setup (Closed)
Patch Set: Created Aug. 23, 2015, 5:02 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env ruby 1 #!/usr/bin/ruby
2 # This script is a node classifier for Puppet that operates on top of Hiera 2 # This script is a node classifier for Puppet that operates on top of Hiera
3 # and uses a custom hosts.yaml config to map host roles. 3 # and uses a custom hosts.yaml config to map host roles.
4 4
5 require 'getoptlong' 5 require 'getoptlong'
6 require 'hiera' 6 require 'hiera'
7 require 'socket' 7 require 'socket'
8 require 'yaml' 8 require 'yaml'
9 9
10 # Where to search for the Hiera configuration 10 # Where to search for the Hiera configuration
11 HIERA_CONFIG = ENV.fetch('PUPPET_HIERA_CONFIG', '/etc/puppet/hiera.yaml') 11 HIERA_CONFIG = ENV.fetch('PUPPET_HIERA_CONFIG', '/etc/puppet/hiera.yaml')
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 parameters = hiera.lookup('parameters', {}, scope, nil, :hash) 81 parameters = hiera.lookup('parameters', {}, scope, nil, :hash)
82 parameters['role'] = role 82 parameters['role'] = role
83 result = { 'classes' => classes, 'parameters' => parameters } 83 result = { 'classes' => classes, 'parameters' => parameters }
84 rescue Exception => error 84 rescue Exception => error
85 STDERR.puts "#{BASENAME}: #{error.message}: #{HIERA_CONFIG}" 85 STDERR.puts "#{BASENAME}: #{error.message}: #{HIERA_CONFIG}"
86 exit 1 86 exit 1
87 end 87 end
88 88
89 puts result.to_yaml 89 puts result.to_yaml
90 90
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld