Commit da3c7c74 authored by Christopher Huhn's avatar Christopher Huhn 🥚
Browse files

Fix complaints from rubocop

parent 9b7b05cb
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
default_unless['debmirror']['base_dir'] = '/srv/debmirror' default_unless['debmirror']['base_dir'] = '/srv/debmirror'
# keyring where debmirror looks for repository keys # keyring where debmirror looks for repository keys
default_unless['debmirror']['keyring'] = node['debmirror']['base_dir'] + "/.gnupg/trustedkeys.gpg" default_unless['debmirror']['keyring'] =
node['debmirror']['base_dir'] + '/.gnupg/trustedkeys.gpg'
# the user that runs the scripts: # the user that runs the scripts:
default_unless['debmirror']['mirrors'] = {} default_unless['debmirror']['mirrors'] = {}
......
...@@ -34,7 +34,7 @@ directory node['debmirror']['base_dir'] ...@@ -34,7 +34,7 @@ directory node['debmirror']['base_dir']
node['debmirror']['mirrors'].each do |name, conf| node['debmirror']['mirrors'].each do |name, conf|
debmirror_repository name do debmirror_repository name do
server conf['server'] server conf['server']
proto conf['method'] if conf['method'] proto conf['method'] if conf['method']
path conf['path'] path conf['path']
distribution conf['release'] if conf['release'] distribution conf['release'] if conf['release']
components conf['section'] if conf['section'] components conf['section'] if conf['section']
......
...@@ -23,24 +23,29 @@ ...@@ -23,24 +23,29 @@
property :arch, Array, default: ['amd64'] property :arch, Array, default: ['amd64']
property :components, Array, default: %w[main] property :components, Array, default: %w[main]
property :deb_src, [true, false], default: false property :deb_src, [true, false], default: false
property :distribution, Array, default: [ node['lsb']['codename'] ] property :distribution, Array, default: [node['lsb']['codename']]
property :user, String, default: node['debmirror']['user'] property :user, String, default: node['debmirror']['user']
property :key, [String, nil] property :key, [String, nil]
property :keyring, [String, nil], default: node['debmirror']['keyring'] property :keyring, [String, nil], default: node['debmirror']['keyring']
property :server, String, default: 'deb.debian.org' property :server, String, default: 'deb.debian.org'
property :proto, String, default: 'http' property :proto, String, default: 'http'
property :path, String, default: "/" property :path, String, default: '/'
property :mirror_dir, [String, nil] property :mirror_dir, [String, nil]
property :options, Array, default: [] property :options, Array, default: []
property :script_dir, String, default: node['debmirror']['script_dir'] property :script_dir, String, default: node['debmirror']['script_dir']
property :rsync_extra, [Array, String, nil], property :rsync_extra, [Array, String, nil],
# turn strings into an array, default to ['trace'] # turn strings into an array, default to ['trace']
coerce: proc { |x| x.is_a?(String) ? Array[x] : x.nil? ? %w[trace] : x } coerce: proc { |x|
if x.is_a?(String)
Array[x]
else
x.nil? ? %w[trace] : x
end
}
default_action :add default_action :add
action :add do action :add do
# TODO: use ruby-gpgme for key management # TODO: use ruby-gpgme for key management
if new_resource.key if new_resource.key
...@@ -61,7 +66,7 @@ action :add do ...@@ -61,7 +66,7 @@ action :add do
" --import <<-EOD\n#{new_resource.key}\nEOD" " --import <<-EOD\n#{new_resource.key}\nEOD"
user user user user
# without $HOME gpg tries to create /root/.gnupg :( # without $HOME gpg tries to create /root/.gnupg :(
environment( 'HOME' => home ) environment('HOME' => home)
# not_if { `gpg --no-default-keyring --keyring #{keyring} --with-colons --fingerprint`match %r{^fpr:+#{fingerpring}:$} } # not_if { `gpg --no-default-keyring --keyring #{keyring} --with-colons --fingerprint`match %r{^fpr:+#{fingerpring}:$} }
end end
end end
...@@ -96,7 +101,7 @@ end ...@@ -96,7 +101,7 @@ end
action :remove do action :remove do
file "#{script_dir}/#{name}.sh" do file "#{script_dir}/#{name}.sh" do
action :remove action :delete
end end
# TODO: Remove key from keyring? # TODO: Remove key from keyring?
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment