Issue #7485 has been updated by Thomas Willert.

Hi,
I'll be happy to help as much as I can in this matter. I am new to Puppet (have 
used CF until now) and can not code any Ruby, but I can try to outline in 
pseudo code what a patch could possibly look like.

As far as I can see the provider for zypper only does "install" and "updates 
check". The update check ("zypper list-updates") works find with both v0.6 and 
v1.0, so no change needed there.

For the rpm installation step, the zypper provider need to made version aware. 
The zypper version number can in both versions be found with "zypper 
--version". For v0.6 the install command need to be "/usr/bin/zypper -n install 
<package>", for v1.0 the install command beed to be "/usr/bin/zypper --quiet 
install -l -y <package>".

Version output in **zypper 0.6.200**:
    # zypper --version
    zypper 0.6.200

Version output in **zypper 1.0.8**:
    # zypper --version
    zypper 1.0.8

**Pseudo/perl code to replace line 25 in 
/.../site_ruby/1.8/puppet/provider/package/zypper.rb**:
    $version=`/usr/bin/zypper --version`;
    if (version =~ /^zypper 0.*$/) {
        $install_options = "-n install";
    } else {
        $install_options = "--quiet install -l -y";
    }
    $output=`/usr/bin/zypper $install_options <wanted>`;


Sorry that my Ruby knowledge is not better, but I hope this is useful anyway. I 
have access to both SLES10 and SLES11 servers so I will have be happy to help 
test this after it have been converted to a Ruby patch.

Cheers,
Thomas 

----------------------------------------
Bug #7485: zypper 0.6 not working with puppet (default version in SLES 10.4 and 
earlier)
https://projects.puppetlabs.com/issues/7485

Author: Thomas Willert
Status: Accepted
Priority: Normal
Assignee: 
Category: package
Target version: 
Affected Puppet version: 2.7.0rc1
Keywords: zypper sles package provider
Branch: 


The Puppet package provider "zypper" is not working for zypper version 0.6. 
This version is the default version in SLES 10.x. Zypper version 1.0 is not 
available until SLES11.x.
The zypper provider is asuming version 1.x as it is using the command options 
"-l", "-y" and "--quiet".
I am using these versions:
    Puppet 2.7.0
    Facter 1.5.7
    zypper-0.6.200-0.4.49
Error message:
    err: /Stage[main]/Sudo/Package[sudo]/ensure: change from absent to present 
failed: Execution of '/usr/bin/zypper --quiet install -l -y sudo' returned 2: 
Unknown option --quiet
    Unknown command '_unknown'.

>From looking at 
>"/usr/lib64/ruby/site_ruby/1.8/puppet/provider/package/zypper.rb" I can see 
>that this provider is coded for zypper 1.0 only. See line 25.
For zypper 0.6 to non-interactive way to install a (sudo) rpm is:
    # zypper -n install sudo
For 0.6 compability the Ruby code for zypper should be extended to include a 
version check.
For version 1.0 do this (same as current):
    # /usr/bin/zypper --quiet install -l -y sudo
For version 0.6 do this:
    # /usr/bin/zypper -n install sudo
     


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to