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 PHP 7.1 support on Debian #293

Merged
merged 4 commits into from
Feb 3, 2018
Merged

Conversation

fstr
Copy link

@fstr fstr commented Jan 16, 2017

I've added support for PHP 7.1 on Debian (jessie, stretch).

PHP 7.1.0-5+0~20161222133327.13+jessie~1.gbp46a191 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.1.0-dev, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.1.0-5+0~20161222133327.13+jessie~1.gbp46a191, Copyright (c) 1999-2016, by Zend Technologies
    with Xdebug v2.5.0, Copyright (c) 2002-2016, by Derick Rethans

I'm not sure if it's the most elegant way to install the required packages and how to avoid name conflicts.

Feedback is welcome.


if ($php::globals::php_version == '7.1') {
# Required packages for PHP 7.1 repository
package { 'apt-transport-https':
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do see that this package is required, but this could break others configuration if they defined the package in a profile.

the same for the other packages declared here.

I really would not do business of adding repos. and such packags. If doing the roles/profiles pattern it should be solved in the profile level. For me this module should not try to add repos. but thats my personal opinion. so many things fail if you would run such things in a restricted environment (no internet access, and the policy to use internal repos).

Right now I can't say what to do with these packages. :-/

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see conflict potential as well in the packages. So I'm also not sure.

If adding repos is not part of this module, then what's the purpose of this file debian.pp?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not the original author of the module. I think it solves problems he or the users have. ;-)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many modules solve this by having a "manage_repo" parameter in the init class.

You should probably also use ensure_packages to avoid conflicts with existing profiles.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

never mind, I noticed that this is indeed gated by such a boolean. Should be fine then.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use stdlib::ensure_packages for this.

}

# Add PHP 7.1 key + repository
create_resources(::apt::key, { 'php::repo::debian-php71' => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why using create_resources() here? why not just plain puppet code?

apt::key { 'php::repo::debian-php71':
  key => 'DF3D585DB8F0EB658690A554AC0E47584A7A714D', 
  key_source => 'https://packages.sury.org/php/apt.gpg',
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True. Just copied from above. Can be plain puppet code.

@@ -24,8 +24,8 @@
puppetversion: Puppet.version,
facterversion: Facter.version
}
default_facts.merge!(YAML.load(File.read(File.expand_path('../default_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_facts.yml', __FILE__))
default_facts.merge!(YAML.load(File.read(File.expand_path('../default_module_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_module_facts.yml', __FILE__))
default_facts.merge!(YAML.safe_load(File.read(File.expand_path('../default_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_facts.yml', __FILE__))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the safe_load rubocop was decided to be blacklisted. the load should be used.

@@ -76,14 +76,14 @@
}
} else {
case $globals_php_version {
/^7/: {
/^7\.[0-9]/: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what problem is solved by changing the regex?

Copy link
Author

@fstr fstr Jan 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Being able to use:
$package_prefix = "php${globals_php_version}-"

Because the package prefix is php7.0- and not php7-
Before that change, the prefix was hardcoded to php7.0-.

@smuggli
Copy link

smuggli commented Jan 27, 2017

For all those who were waiting for a dotdeb release.

https://www.dotdeb.org/2017/01/27/php-7-1-dotdeb/

.rubocop.yml Outdated
@@ -302,7 +302,7 @@ Style/EmptyLiteral:
Metrics/LineLength:
Enabled: False

Style/MethodCallParentheses:
Style/MethodCallWithoutArgsParentheses:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will modulesync overwrite this? @bastelfreak

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ffrank
Copy link

ffrank commented Oct 3, 2017

Hi @fstr is this still on your plate? Do you need anything from our end?

@jonhattan
Copy link
Contributor

This needs a reroll. The fix for package_prefix was already committed in #329

Florian Strübe and others added 3 commits February 3, 2018 11:12
use ensure_packages

dont wrap apt::key in a useless create_resources
This version automatically installs the apt-transport-https package,
which is needed for https mirrors. By using this module in at least this
version, we don't need to manage the package on our own.
this is the lowest supported version for ensure_packages
@bastelfreak
Copy link
Member

I rebased the branch and implemented the changes @Vincent-- mentioned.

this is a private class, it won't get called directly, only from within
the main class. It references variables from the main class, so we
need to include it (or move the tests into the testfile for the main
class)
@bastelfreak bastelfreak added the enhancement New feature or request label Feb 3, 2018
@bastelfreak bastelfreak merged commit f3c6e4a into voxpupuli:master Feb 3, 2018
@jonhattan
Copy link
Contributor

Sorry I don't think this PR is the proper solution. At the end we want dotdeb for wheezy (php 5.6) and sury for jessie and stretch (5.6, 7.0, 7.1 and 7.2 as of now). I'll try to propose a PR in the coming days.

c33s added a commit to c33s/puppet-php that referenced this pull request Feb 16, 2018
@c33s
Copy link
Member

c33s commented Feb 16, 2018

@jonhattan you are right, we want dotdeb for wheezy and sury for jessie and strech. ping me if you start working on a PR

this PR actually break things. it

  • uses the old apt:key syntax
  • ensure different packages as it require afterwards
  • uses the old facts syntax
  • hardcodes the repo key id
  • cannot be disabled (something like $sury = false)

@EpiqSty
Copy link

EpiqSty commented Jul 4, 2018

Hi,

First of all thanks for great work ;) We used that module for a while, but now we have tried to install PHP 7.1 on Debian 9 , and faced with those errors:

Error: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install php7.1-cli' returned 100: Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package php7.1-cli
E: Couldn't find any package by glob 'php7.1-cli'
E: Couldn't find any package by regex 'php7.1-cli'
Error: /Stage[main]/Php::Packages/Package[php7.1-cli]/ensure: change from 'purged' to 'present' failed: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install php7.1-cli' returned 100: Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package php7.1-cli
E: Couldn't find any package by glob 'php7.1-cli'
E: Couldn't find any package by regex 'php7.1-cli'
Error: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install php7.1-common' returned 100: Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package php7.1-common
E: Couldn't find any package by glob 'php7.1-common'
E: Couldn't find any package by regex 'php7.1-common'
Error: /Stage[main]/Php::Packages/Package[php7.1-common]/ensure: change from 'purged' to 'present' failed: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install php7.1-common' returned 100: Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package php7.1-common
E: Couldn't find any package by glob 'php7.1-common'
E: Couldn't find any package by regex 'php7.1-common'

Does it mean, that such combination (PHP7.1 & Debian 9) still not supported by module, or we have to add some custom configuration?

For now we just defined desired version this way:

php::globals::php_version: '7.1'

is it enough or not?

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

Successfully merging this pull request may close these issues.

None yet