Skip to content

Commit

Permalink
Allow to pass optional environment for each server name
Browse files Browse the repository at this point in the history
The format is servername/environment
  • Loading branch information
raphink committed May 27, 2015
1 parent fabf3ec commit 6e9bc83
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion lib/puppet/catalog-diff/compilecatalog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ def lookup_environment(node_name)
end

def compile_catalog(node_name,server)
environment = lookup_environment(node_name)
server,environment = server.split('/')
environment ||= lookup_environment(node_name)
endpoint = "/#{environment}/catalog/#{node_name}"
Puppet.debug("Connecting to server: #{server}")
begin
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/catalog-diff/searchfacts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def find_nodes(options = {})
if options[:use_puppetdb]
active_nodes = find_nodes_puppetdb()
else
active_nodes = find_nodes_rest(options[:old_server])
active_nodes = find_nodes_rest(options[:old_server].split('/')[0])
end
if active_nodes.empty?
raise "No active nodes were returned from your fact search"
Expand Down
4 changes: 2 additions & 2 deletions lib/puppet/face/catalog/diff.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@

else
# User passed use two hostnames
old_catalogs = Dir.mktmpdir("#{catalog1}-")
new_catalogs = Dir.mktmpdir("#{catalog2}-")
old_catalogs = Dir.mktmpdir("#{catalog1.gsub('/', '_')}-")
new_catalogs = Dir.mktmpdir("#{catalog2.gsub('/', '_')}-")
pull_output = Puppet::Face[:catalog, '0.0.1'].pull(old_catalogs,new_catalogs,options[:fact_search],:old_server => catalog1,:new_server => catalog2,:changed_depth => options[:changed_depth], :threads => options[:threads])
diff_output = Puppet::Face[:catalog, '0.0.1'].diff(old_catalogs,new_catalogs,options)
nodes = diff_output
Expand Down

0 comments on commit 6e9bc83

Please sign in to comment.