Mentions légales du service

Skip to content
Snippets Groups Projects
Commit ab434edc authored by Alexandre MERLIN's avatar Alexandre MERLIN
Browse files

[gen/puppet/access] allow for empty accesses files

parent caf82952
No related branches found
No related tags found
No related merge requests found
Pipeline #982246 passed
...@@ -79,7 +79,7 @@ end ...@@ -79,7 +79,7 @@ end
def load_yaml_from_git(git_repo, sha, yaml_path) def load_yaml_from_git(git_repo, sha, yaml_path)
relative_path = yaml_path.sub(git_repo.repo.path.gsub(/\.git$/, ''), '') relative_path = yaml_path.sub(git_repo.repo.path.gsub(/\.git$/, ''), '')
YAML.load(git_repo.show("#{sha}:#{relative_path}"), **$yaml_load_args) YAML.load(git_repo.show("#{sha}:#{relative_path}"), **$yaml_load_args) || {}
end end
# Update history only if the mode changed, if so we terminate the last entry and # Update history only if the mode changed, if so we terminate the last entry and
...@@ -208,7 +208,8 @@ def generate_access_level(options) ...@@ -208,7 +208,8 @@ def generate_access_level(options)
site_data_hierarchy['sites'].each_key do |site| site_data_hierarchy['sites'].each_key do |site|
site_config_path = File.join(options[:conf_dir], "#{site}.yaml") site_config_path = File.join(options[:conf_dir], "#{site}.yaml")
if File.exist?(site_config_path) if File.exist?(site_config_path)
nodesets.update(YAML.load_file(site_config_path, **$yaml_load_args)) yaml_access_file = YAML.load_file(site_config_path, **$yaml_load_args)
nodesets.update(yaml_access_file) unless yaml_access_file.nil?
else else
puts "Warning: Skipping #{site} configuration since there is no file" puts "Warning: Skipping #{site} configuration since there is no file"
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment