Skip to content

Commit

Permalink
Merge pull request #2 from raphink/dev/pass_env
Browse files Browse the repository at this point in the history
Allow to pass optional environment for each server name
  • Loading branch information
acidprime committed Jun 2, 2015
2 parents e864c9b + 6e9bc83 commit d1c8ab6
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 @@ -119,8 +119,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 d1c8ab6

Please sign in to comment.