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

Fix complaints from rubocop

parent 9b7b05cb
......@@ -2,7 +2,8 @@
default_unless['debmirror']['base_dir'] = '/srv/debmirror'
# 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:
default_unless['debmirror']['mirrors'] = {}
......@@ -34,7 +34,7 @@ directory node['debmirror']['base_dir']
node['debmirror']['mirrors'].each do |name, conf|
debmirror_repository name do
server conf['server']
proto conf['method'] if conf['method']
proto conf['method'] if conf['method']
path conf['path']
distribution conf['release'] if conf['release']
components conf['section'] if conf['section']
......@@ -23,24 +23,29 @@
property :arch, Array, default: ['amd64']
property :components, Array, default: %w[main]
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 :key, [String, nil]
property :keyring, [String, nil], default: node['debmirror']['keyring']
property :server, String, default: ''
property :proto, String, default: 'http'
property :path, String, default: "/"
property :path, String, default: '/'
property :mirror_dir, [String, nil]
property :options, Array, default: []
property :script_dir, String, default: node['debmirror']['script_dir']
property :rsync_extra, [Array, String, nil],
# 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)
x.nil? ? %w[trace] : x
default_action :add
action :add do
# TODO: use ruby-gpgme for key management
if new_resource.key
......@@ -61,7 +66,7 @@ action :add do
" --import <<-EOD\n#{new_resource.key}\nEOD"
user user
# 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}:$} }
......@@ -96,7 +101,7 @@ end
action :remove do
file "#{script_dir}/#{name}.sh" do
action :remove
action :delete
# TODO: Remove key from keyring?
Supports Markdown
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