Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add priority as comment in header for debian #74

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kronos-pbrideau
Copy link
Contributor

The phpenmod script use this comment... When php modules are upgraded via the package manager, it run this script and reenable script which look like not present for the system...

=== Example with mysqlnd ===
Debian create in with priority 10 when installing so it is linked as
/etc/php5/cli/conf.d/10-mysqlnd.ini -> ../../mods-available/mysqlnd.ini

Then php puppet module replace mysqlnd.ini without the comment.
(; priority=10)

When a package upgrade pass on debian 8, it goes:
/usr/share/php5/php5-helper

get_priority() {
[...]
    local source_ini="/etc/php5/mods-available/${modname}.ini"
[...]
    priority=$(sed -ne "s/^; priority=\([0-9]\+\)$/\\1/p" $source_ini)
    [ -z "$priority" ] && priority=20
[...]

So default to priority=20

/usr/sbin/php5enmod

enmod() {
[...]
    local priority=$(get_priority $sapi $modname)
[...]

And create another
/etc/php5/cli/conf.d/20-mysqlnd.ini -> ../../mods-available/mysqlnd.ini

So in the end, we have both and result in lots of warnings and errors:

/etc/php5/cli/conf.d/10-mysqlnd.ini -> ../../mods-available/mysqlnd.ini
/etc/php5/cli/conf.d/20-mysqlnd.ini -> ../../mods-available/mysqlnd.ini

@thias
Copy link
Owner

thias commented Oct 15, 2015

Interesting. Do you think it's worth merging somehow with the existing $prefix parameter, which is very similar? Could you at least make this conditionally enabled only on Debian systems? (I have no idea if it's also relevant to Ubuntu or not...)

@thias thias self-assigned this Oct 15, 2015
@kronos-pbrideau
Copy link
Contributor Author

Well, the $prefix variable is used to rename files in /etc/php5/mods-available/ as i see... They are needed when you want to set priority directly in your config file. (older debian config? redhat config? I don't know where, but i guess someone uses it?)

In Debian based, the files in /etc/php5/(apache2|fpm|cli)/conf.d/ are the one containing this priority bit, but they are not managed with the puppet module. They are symlinks to /mods-available, and created by the packages of the modules...

the module ::php::module { 'mysqlnd' : } install the package php5-mysqlnd and will create these files depending of what is installed on your system:
/etc/php5/apache2/conf.d/10-mysqlnd.ini -> /etc/php5/mods-available/mysqlnd.ini
/etc/php5/cli/conf.d/10-mysqlnd.ini -> /etc/php5/mods-available/mysqlnd.ini
/etc/php5/fpm/conf.d/10-mysqlnd.ini -> /etc/php5/mods-available/mysqlnd.ini

Note the 10-mysqlnd.ini is not in /etc/php5/mod-available/ but (apache|fpm|cli)

If we use the $prefix variable to set this priority, we will end-up with an non-existing symlink, or worse, the file /etc/php5/mods-available/mysqlnd.ini created by the package manager, but not managed by ::php::module::ini { 'mysqlnd' : }

And yes, it is also relevant to Ubuntu.

a simple change like <% if @osfamily == 'Debian' and @priority -%> would be sufficient i guess

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants