From e17356f22505f0aed88fd04c9925b8aeb2520e28 Mon Sep 17 00:00:00 2001 From: Danilo Sousa Date: Tue, 16 Feb 2016 14:18:07 -0200 Subject: `Node#repo` should return the node group repository --- lib/oxidized/node.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'lib/oxidized/node.rb') diff --git a/lib/oxidized/node.rb b/lib/oxidized/node.rb index 7a278a9..a1504b9 100644 --- a/lib/oxidized/node.rb +++ b/lib/oxidized/node.rb @@ -24,7 +24,7 @@ module Oxidized @vars = opt[:vars] @stats = Stats.new @retry = 0 - @repo = Oxidized.config.output.git.repo + @repo = resolve_repo # model instance needs to access node instance @model.node = self @@ -170,5 +170,17 @@ module Oxidized Oxidized.mgr.model[model].new end + def resolve_repo + git = Oxidized.config.output.git + cfg_repo = git.repo + + if group && !git.single_repo? + basedir = File.dirname(cfg_repo) + File.join(basedir, "#{group}.git") + else + cfg_repo + end + end + end end -- cgit v1.2.1 From 69210c7ddf7d77cc9eb7b78f0bc00ad2f1475955 Mon Sep 17 00:00:00 2001 From: Danilo Sousa Date: Mon, 22 Feb 2016 14:16:29 -0300 Subject: follow the hook remotes config also for groups repositories ref.: https://github.com/ytti/oxidized/pull/326/files#r53557892 --- lib/oxidized/node.rb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'lib/oxidized/node.rb') diff --git a/lib/oxidized/node.rb b/lib/oxidized/node.rb index a1504b9..35bcad9 100644 --- a/lib/oxidized/node.rb +++ b/lib/oxidized/node.rb @@ -171,14 +171,12 @@ module Oxidized end def resolve_repo - git = Oxidized.config.output.git - cfg_repo = git.repo + remote_repo = Oxidized.config.output.git.repo - if group && !git.single_repo? - basedir = File.dirname(cfg_repo) - File.join(basedir, "#{group}.git") + if Oxidized.config.output.git.single_repo? || @group.nil? || remote_repo.is_a?(String) + remote_repo else - cfg_repo + remote_repo[@group] end end -- cgit v1.2.1