jarosser06 / chef-zypper

Chef Zypper cookbook
1 stars 6 forks source link

Own build keys not supported #1

Closed kleini closed 9 years ago

kleini commented 9 years ago

We sign our packages for SUSE Linux distributions with our own build key. When adding our software repositories using this cookbook we currently do no have the possibility to download and add our build key within the zypper_repo resource.

The apt and yum cookbooks provide support for own build keys.

kleini commented 9 years ago

I solved it by manually importing our own build keys using

zypper_repo repositoryAlias do
    uri url
    autorefresh true
    action :nothing
end
execute 'import-oxbuilkey' do
    command "rpm --import #{node['open-xchange']['repository']['buildkey']}"
    action :nothing
    notifies :add, "zypper_repo[#{repositoryAlias}]"
end
# Ensure package curl is installed. RPM uses curl to download the public key but the rpm package lacks a dependency on curl
package 'curl' do
    action :install
    notifies :run, 'execute[import-oxbuilkey]', :immediately
end

Please notice the workaround for the missing curl dependency on the rpm package of SUSE Linux Enterprise Server 12.

jarosser06 commented 9 years ago

Thanks for opening this issue. I will take a look at adding this functionality.

kleini commented 9 years ago

It does not work using the notify mechanism of Chef. Instead I had to reorder the resources. Otherwise added zypper repositories are not considered for packages to be installed.

# Workaround for https://bugzilla.opensuse.org/show_bug.cgi?id=941804
package 'curl' do
    action :install
end
execute 'import-oxbuilkey' do
    command "rpm --import #{node['open-xchange']['repository']['buildkey']}"
    action :run
end
node['open-xchange']['repository']['repos'].each do |reponame, enable|
    next unless enable
    zypper_repo "Open-Xchange_#{reponame}" do
        uri OXRepo.build_url(reponame, node)
        autorefresh true
        action :add
    end
end
execute 'update-repositories' do
    command 'zypper refresh'
    action :run
end
jarosser06 commented 9 years ago

@kleini does PR #2 solve this for you?

kleini commented 9 years ago

Your PR #2 looks good. I will test it, when I get time for that.

kleini commented 9 years ago

It works now using the following code to add our repositories:

node['open-xchange']['repository']['repos'].each do |reponame, enable|
    next unless enable
    zypper_repo "Open-Xchange_#{reponame}" do
        uri OXRepo.build_url(reponame, node)
        autorefresh true
        action :add
        key node['open-xchange']['repository']['buildkey']
    end
end
kleini commented 9 years ago

When will a release with this change be available?

jarosser06 commented 9 years ago

A new release should now be available on Supermarket.

kleini commented 9 years ago

Great!