Skip to content

Instantly share code, notes, and snippets.

@mattray
Created August 20, 2018 02:58
Show Gist options
  • Save mattray/a5b996fd9fdcb002326d5ff04eecbf8a to your computer and use it in GitHub Desktop.
Save mattray/a5b996fd9fdcb002326d5ff04eecbf8a to your computer and use it in GitHub Desktop.
repodir = '/etc/yum.repos.d/'
# remove all undesired (unspecified) repos
Dir[repodir + '*.repo'].each do |file_name|
repo_name = File.basename(file_name, '.repo')
unless node['software']['repo'].values.member?(repo_name)
yum_repository repo_name do
action :delete
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment