Skip to content

Commit d1c8ab6

Browse files
committed
Merge pull request acidprime#2 from raphink/dev/pass_env
Allow to pass optional environment for each server name
2 parents e864c9b + 6e9bc83 commit d1c8ab6

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

lib/puppet/catalog-diff/compilecatalog.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ def lookup_environment(node_name)
3434
end
3535

3636
def compile_catalog(node_name,server)
37-
environment = lookup_environment(node_name)
37+
server,environment = server.split('/')
38+
environment ||= lookup_environment(node_name)
3839
endpoint = "/#{environment}/catalog/#{node_name}"
3940
Puppet.debug("Connecting to server: #{server}")
4041
begin

lib/puppet/catalog-diff/searchfacts.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def find_nodes(options = {})
1515
if options[:use_puppetdb]
1616
active_nodes = find_nodes_puppetdb()
1717
else
18-
active_nodes = find_nodes_rest(options[:old_server])
18+
active_nodes = find_nodes_rest(options[:old_server].split('/')[0])
1919
end
2020
if active_nodes.empty?
2121
raise "No active nodes were returned from your fact search"

lib/puppet/face/catalog/diff.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@
119119

120120
else
121121
# User passed use two hostnames
122-
old_catalogs = Dir.mktmpdir("#{catalog1}-")
123-
new_catalogs = Dir.mktmpdir("#{catalog2}-")
122+
old_catalogs = Dir.mktmpdir("#{catalog1.gsub('/', '_')}-")
123+
new_catalogs = Dir.mktmpdir("#{catalog2.gsub('/', '_')}-")
124124
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])
125125
diff_output = Puppet::Face[:catalog, '0.0.1'].diff(old_catalogs,new_catalogs,options)
126126
nodes = diff_output

0 commit comments

Comments
 (0)