Skip to content

Commit

Permalink
Merge pull request #70 from smortex/add-freebsd-support
Browse files Browse the repository at this point in the history
(#69) Add FreeBSD support
  • Loading branch information
ripienaar authored Jul 29, 2020
2 parents eca1957 + 9ff47ea commit 0a96697
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 6 additions & 2 deletions lib/mcollective/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ def self.mcollective_config_paths_for_user
else
config_paths << "/etc/puppetlabs/mcollective/client.cfg"
config_paths << "/etc/mcollective/client.cfg"
config_paths << "/usr/local/etc/mcollective/client.cfg"
end

config_paths
Expand All @@ -188,22 +189,25 @@ def self.choria_config_paths_for_user
config_paths << File.join(choria_windows_prefix, "etc", "client.conf")
else
config_paths << "/etc/choria/client.conf"
config_paths << "/usr/local/etc/choria/client.conf"
end

config_paths
end

# Picks the default user config file, pririties are first Choria ones then old MCollective ones
# Picks the default user config file, priorities are first Choria ones then old MCollective ones
#
# In roughly this order, first to exist is used:
#
# - ~/.choriarc
# - APPData/ChoriaIO/choria/etc/client.conf on windows
# - /etc/choria/client.conf on unix
# - /etc/choria/client.conf then
# - /usr/local/etc/choria/client.conf on unix
# - ~/.mcollective
# - APPData/PuppetLabs/mcollective/etc/client.cfg on windows
# - /etc/puppetlabs/mcollective/client.cfg
# - /etc/mcollective/client.cfg
# - /usr/local/etc/mcollective/client.cfg
def self.config_file_for_user
config_paths = choria_config_paths_for_user + mcollective_config_paths_for_user
found = config_paths.find_index { |file| File.readable?(file) } || 0
Expand Down
6 changes: 4 additions & 2 deletions spec/unit/mcollective/util_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ module MCollective
expect(Util.mcollective_config_paths_for_user).to eq([
File.expand_path("~/.mcollective"),
"/etc/puppetlabs/mcollective/client.cfg",
"/etc/mcollective/client.cfg"
"/etc/mcollective/client.cfg",
"/usr/local/etc/mcollective/client.cfg"
])
end

Expand All @@ -223,7 +224,8 @@ module MCollective

expect(Util.choria_config_paths_for_user).to eq([
File.expand_path("~/.choriarc"),
"/etc/choria/client.conf"
"/etc/choria/client.conf",
"/usr/local/etc/choria/client.conf"
])
end

Expand Down

0 comments on commit 0a96697

Please sign in to comment.