# HG changeset patch # User Ian Baum <ibaum@gitlab.com> # Date 1634149296 18000 # Wed Oct 13 13:21:36 2021 -0500 # Node ID 495de44fca4f700f900cf8e7aef32fd57a4fe8d0 # Parent 42c815dee8fdc5837e8a0eb4f1d471a18c7cd070 Don't generate public_attributes.json on non-reconfigure runs * Adds a conditional (default false) to generate the public_attributes.json file. We only want to do this for a full reconfigure run (which uses dna.json). Changelog: fixed diff --git a/config/templates/gitlab-cookbooks/dna.json.erb b/config/templates/gitlab-cookbooks/dna.json.erb --- a/config/templates/gitlab-cookbooks/dna.json.erb +++ b/config/templates/gitlab-cookbooks/dna.json.erb @@ -1,3 +1,6 @@ { - "run_list": [ "recipe[<%= master_cookbook %>]" ] + "run_list": [ "recipe[<%= master_cookbook %>]" ], + "package": { + "public_attributes": true + } } diff --git a/files/gitlab-cookbooks/package/attributes/default.rb b/files/gitlab-cookbooks/package/attributes/default.rb --- a/files/gitlab-cookbooks/package/attributes/default.rb +++ b/files/gitlab-cookbooks/package/attributes/default.rb @@ -26,6 +26,10 @@ default['package']['systemd_wanted_by'] = 'multi-user.target' default['package']['systemd_after'] = 'multi-user.target' +# We only want to generate the public attributes file on specific calls to Chef. +# Normally, you will not want to change this +default['package']['public_attributes'] = false + # Setting runit defaults here so that they can be made available automatically # to cookbooks of individual services via depends in metadata.rb default['runit']['sv_bin'] = '/opt/gitlab/embedded/bin/sv' diff --git a/files/gitlab-cookbooks/package/libraries/handlers/gitlab.rb b/files/gitlab-cookbooks/package/libraries/handlers/gitlab.rb --- a/files/gitlab-cookbooks/package/libraries/handlers/gitlab.rb +++ b/files/gitlab-cookbooks/package/libraries/handlers/gitlab.rb @@ -34,6 +34,8 @@ class Attributes < Chef::Handler # Generate a JSON file of attributes which non-root users need access to def report + return unless node['package']['public_attributes'] + data = {} BaseHelper.descendants.each do |klass| k = klass.send(:new, node)