thias / puppet-php

Puppet module to manage PHP
Other
49 stars 67 forks source link

error trying downgrade version php-fpm #54

Open pcarrilloj opened 9 years ago

pcarrilloj commented 9 years ago

in centos-6.5-i386

When I try to set specific version of php-fpm for and older one, fail because php-common is already installed in a newer version. even in a fresh installation (I'm using it in vagrant).

this is my class, it works if I don't try force the version number

class appsrv {
    require yum::repo::remi
    require yum::repo::epel
    require yum::repo::remi_php55
    # For the user to exist
    require websrv
    package { 'libtidy':
        ensure  => present,
    }
    package { 'libtidy-devel':
        ensure  => present,
    } 
    package { 'php-tidy':
        ensure  => present,
    }
    package { 'yum-allowdowngrade':
        ensure  => present,
    }
    php::module { [ 'pecl-apcu',
                'pear',
                'pdo',
                'mysqlnd',
                'pgsql',
                'pecl-mongo',
                'pecl-sqlite',
                'mbstring',
                'mcrypt',
                'xml',
                'pecl-memcached',
                'gd',
                'soap']:
                notify  => Service['php-fpm'],
                }

    php::fpm::conf { 'www':
      listen  => '127.0.0.1:9001',
      user    => 'nginx',
      pm_status_path => '/status',
    }~>File['/var/log/php-fpm']

    class { php::fpm::daemon:
        ensure => '5.4.35', 
        log_owner => 'nginx',
        log_group => 'nginx',
        log_dir_mode => '0775',
    }
    php::ini { '/etc/php.ini':
      short_open_tag             => 'On',
      asp_tags                   => 'Off',
      date_timezone             =>'America/Mexico_City',
      error_reporting           => 'E_ALL',
      display_errors            => 'On',
      html_errors               => 'On',
      notify  => Service['php-fpm'],
    }
    file { '/var/log/php-fpm/www-error.log':
      ensure => "file",
      owner  => "nginx",
      group  => "nginx",
      mode   => 664
    }
    file { '/var/log/php-fpm/error.log':
      ensure => "file",
      owner  => "root",
      group  => "nginx",
      mode   => 664,
    }
}

and this is the error (the relevant part only)

Execution of '/usr/bin/yum -d 0 -e 0 -y install php-fpm-5.4.35' returned 1: Error: Package: php-fpm-5.4.35-1.el6.remi.i686 (remi)
           Requires: php-common(x86-32) = 5.4.35-1.el6.remi
           Installed: php-common-5.5.20-2.el6.remi.i686 (@remi-php55)
               php-common(x86-32) = 5.5.20-2.el6.remi
           Available: php-common-5.3.3-38.el6.i686 (base)
               php-common(x86-32) = 5.3.3-38.el6
           Available: php-common-5.3.3-40.el6_6.i686 (updates)
               php-common(x86-32) = 5.3.3-40.el6_6
           Available: php-common-5.4.35-1.el6.remi.i686 (remi)
               php-common(x86-32) = 5.4.35-1.el6.remi
           Available: php-common-5.4.36-1.el6.remi.i686 (remi)
               php-common(x86-32) = 5.4.36-1.el6.remi
           Available: php-common-5.5.19-2.el6.remi.i686 (remi-php55)
               php-common(x86-32) = 5.5.19-2.el6.remi
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest
thias commented 9 years ago

This is a tricky case to handle... I can think of ways using hiera to override class parameters, but I can't think of any simple ways which would work in pure puppet DSL (such as your example).

Do you have the ability to use hiera? If you do, then it should be possible to add a new ensure parameter to the common class, which would be the only one needing to be set to the version you require, then all of the other classes which need one of the other main packages would have access to that variable after including the common class, and use it to set the ensure parameter for their own package.