-
-
Notifications
You must be signed in to change notification settings - Fork 268
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
WIP: Feature/simon hoenscheid 603 restructure repository management #605
Changes from 11 commits
6eeb0b0
fcf3f4c
f25392b
1345bab
7b3bcd4
c918c71
9c58a9d
b60982f
6d451aa
7e4a9b0
e7a10a6
fb9c572
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,6 +86,7 @@ jobs: | |
branches: | ||
only: | ||
- master | ||
- module_rewrite | ||
- /^v\d/ | ||
notifications: | ||
email: false | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--- |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--- |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--- |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--- |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
php::external_repo: false | ||
php::php_version: '7.3' | ||
php::os_supported_php_versions: | ||
- '7.3' | ||
|
||
php::external_repo_supported_php_versions: | ||
- '5.6' | ||
- '7.0' | ||
- '7.1' | ||
- '7.2' | ||
- '7.3' | ||
- '7.4' | ||
|
||
php::external_repo_details: | ||
'source_php_sury': | ||
comment: 'the debian sury repo sury.org' | ||
location: 'https://packages.sury.org/php/' | ||
repos: 'main' | ||
include: | ||
src: true | ||
deb: true | ||
key: | ||
id: '15058500A0235D97F5D10063B188E2B695BD4743' | ||
source: 'https://packages.sury.org/php/apt.gpg' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--- |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--- |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--- |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--- |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--- |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--- |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--- |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--- |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--- |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--- |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--- |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--- |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--- |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--- |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--- |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--- |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--- |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--- |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--- |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
--- | ||
|
||
lookup_options: | ||
php::fpm::pools: | ||
merge: first | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,13 @@ | ||
--- | ||
version: 5 | ||
defaults: | ||
datadir: 'data' | ||
data_hash: 'yaml_data' | ||
|
||
hierarchy: | ||
- name: default.yaml | ||
- name: 'My Hierarchies' | ||
paths: | ||
- 'default.yaml' | ||
- '%{facts.os.name}/%{facts.os.distro.release.major}.yaml' | ||
- '%{facts.os.name}/%{facts.os.release.full}.yaml' | ||
- '%{facts.os.name}/%{facts.os.release.major}.yaml' | ||
- 'common.yaml' |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,32 +1,53 @@ | ||||||
# Configure package repository | ||||||
# @api private | ||||||
# @summary Configure package repository | ||||||
# | ||||||
class php::repo { | ||||||
$msg_no_repo = "No repo available for ${facts['os']['family']}/${facts['os']['name']}" | ||||||
# @param [Boolean] manage_external_repo | ||||||
# manage an external package repository or not | ||||||
# @option external_repo [Boolean] :false | ||||||
# default | ||||||
# @option external_repo [Boolean] :true | ||||||
# | ||||||
# @param [Array] external_repo_supported_php_versions | ||||||
# The PHP versions the additional repositories support | ||||||
# @option external_repo_supported_php_versions [Array] :[] | ||||||
# default: empty array, default for OS from Hiera Data in module | ||||||
# | ||||||
# @param [Boolean] manage_internal_repo | ||||||
# manage an internal package repository, parameter is to control | ||||||
# app streams in CENTOS/RHEL/Fedora, Repos on FreeBSD or Archlinux | ||||||
# @option external_repo [Boolean] :false | ||||||
# true | ||||||
# @option external_repo [Boolean] :true | ||||||
# | ||||||
# @param [Array] os_supported_php_versions | ||||||
# The PHP versions the OS supports by default, without any additional repositories, | ||||||
# on RHEL/CentOS and Fedora this includes app streams, on FreeBSD or Archlinux it manages Repos | ||||||
# @option os_supported_php_versions [Array] :[] | ||||||
# default: empty array, default for OS from Hiera Data in module | ||||||
# | ||||||
# @param [String] php_version | ||||||
# Set the PHP version to install | ||||||
# @option php_version [String] :'7.4' | ||||||
# defaults: latest stable PHP Version available on php.net, default for OS from Hiera Data in module | ||||||
# | ||||||
class php::repo ( | ||||||
Boolean $manage_internal_repo = $php::manage_internal_repo, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not sure if we need internal and external as definition. isn't it simply repository? why we need to differ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In my opinion yes, because there are operating systems where we need to manage internal and external repos (RHEL/CENTOS/Fedora) app channel/Remi and if I want to have different data without interpolation this seems to be the way to go There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't know about centos & co, you manage the internal and the external repo for php? is it relevant if it is external or internal? isn't it just multiple There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Its been a while since I worked with Fedora based systems, it only affects RHEL8/CENTOS8 and Fedora IDK which version RHEL8 was branched from +. For me this seems important, because it will prevent users declaring internal and external php versions/sources parallel. |
||||||
Boolean $manage_external_repo = $php::manage_external_repo, | ||||||
Optional[Array] $external_repo_supported_php_versions = $php::external_repo_supported_php_versions, | ||||||
Array $os_supported_php_versions = $php::os_supported_php_versions, | ||||||
Optional[String[1]] $php_version = $php::php_version, | ||||||
|
||||||
case $facts['os']['family'] { | ||||||
'Debian': { | ||||||
# no contain here because apt does that already | ||||||
case $facts['os']['name'] { | ||||||
'Debian': { | ||||||
include php::repo::debian | ||||||
} | ||||||
'Ubuntu': { | ||||||
include php::repo::ubuntu | ||||||
} | ||||||
default: { | ||||||
fail($msg_no_repo) | ||||||
} | ||||||
} | ||||||
} | ||||||
'FreeBSD': {} | ||||||
'Suse': { | ||||||
contain php::repo::suse | ||||||
} | ||||||
'RedHat': { | ||||||
contain 'php::repo::redhat' | ||||||
} | ||||||
default: { | ||||||
fail($msg_no_repo) | ||||||
) { | ||||||
assert_private() | ||||||
|
||||||
if (($manage_internal_repo or $manage_external_repo) and (($php_version in $external_repo_supported_php_versions) or ($php_version in $os_supported_php_versions))) { | ||||||
case $facts['os']['name'] { | ||||||
'Archlinux': { contain 'php::repo::archlinux' } | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for arch and freebsd, should we just do nothing? since those don't have external repositories.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The classes are for generally managing repos, is there no need to connect a specific one, for a specific php version? Kind of the same problem exists for RHEL 8 style distros, there is the need to activate a specific app stream There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will implement this |
||||||
'FreeBSD': { contain 'php::repo::freebsd' } | ||||||
'RedHat', 'CentOS', 'Fedora': { contain 'php::repo::redhat' } | ||||||
'Debian', 'Ubuntu': { contain 'php::repo::debian' } | ||||||
'OpenSuSE', 'SLES': { contain 'php::repo::suse' } | ||||||
default: { contain 'php::repo::fallback' } | ||||||
} | ||||||
} | ||||||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# @api private | ||
# @summary Configure archlinux repo | ||
# | ||
# @param [Hash] external_repo_details | ||
# The PHP versions the additional repositories support | ||
# @option external_repo_details [Hash] :{} | ||
# default: empty Hash, default for OS from Hiera Data in module | ||
# | ||
class php::repo::archlinux ( | ||
Hash[String[1], Hash] $external_repo_details = $php::external_repo_details, | ||
) { | ||
assert_private() | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,21 @@ | ||
# Configure debian apt repo | ||
# @api private | ||
# @summary Configure debian apt repo | ||
# | ||
# === Parameters | ||
# | ||
# [*location*] | ||
# Location of the apt repository | ||
# | ||
# [*release*] | ||
# Release of the apt repository | ||
# | ||
# [*repos*] | ||
# Apt repository names | ||
# | ||
# [*include_src*] | ||
# Add source source repository | ||
# | ||
# [*key*] | ||
# Public key in apt::key format | ||
# | ||
# [*dotdeb*] | ||
# Enable special dotdeb handling | ||
# | ||
# [*sury*] | ||
# Enable special sury handling | ||
# @param [Hash] external_repo_details | ||
# The PHP versions the additional repositories support | ||
# @option external_repo_details [Hash] :{} | ||
# default: empty Hash, default for OS from Hiera Data in module | ||
# | ||
class php::repo::debian ( | ||
$location = 'https://packages.dotdeb.org', | ||
$release = 'wheezy-php56', | ||
$repos = 'all', | ||
$include_src = false, | ||
$key = { | ||
'id' => '6572BBEF1B5FF28B28B706837E3F070089DF5277', | ||
'source' => 'http://www.dotdeb.org/dotdeb.gpg', | ||
}, | ||
$dotdeb = true, | ||
$sury = true, | ||
Hash[String[1], Hash] $external_repo_details = $php::external_repo_details, | ||
) { | ||
assert_private() | ||
|
||
include 'apt' | ||
|
||
apt::source { "source_php_${release}": | ||
location => $location, | ||
release => $release, | ||
repos => $repos, | ||
include => { | ||
'src' => $include_src, | ||
'deb' => true, | ||
}, | ||
key => $key, | ||
} | ||
|
||
if ($sury and $php::globals::php_version in ['7.1','7.2']) { | ||
apt::source { 'source_php_sury': | ||
location => 'https://packages.sury.org/php/', | ||
repos => 'main', | ||
include => { | ||
'src' => $include_src, | ||
'deb' => true, | ||
}, | ||
key => { | ||
id => '15058500A0235D97F5D10063B188E2B695BD4743', | ||
source => 'https://packages.sury.org/php/apt.gpg', | ||
}, | ||
$external_repo_details.each |String $repository, Hash $repository_details| { | ||
apt::source { $repository: | ||
* => $repository_details, | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# @api private | ||
# @summary the fallback class, throws an error, if called | ||
class php::repo::fallback () { | ||
assert_private() | ||
$msg_no_repo = "No repo available for ${facts['os']['family']}/${facts['os']['name']}" | ||
|
||
fail($msg_no_repo) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# @api private | ||
# @summary Configure Freebsd repos | ||
# | ||
# @param [Hash] external_repo_details | ||
# The PHP versions the additional repositories support | ||
# @option external_repo_details [Hash] :{} | ||
# default: empty Hash, default for OS from Hiera Data in module | ||
class php::repo::freebsd ( | ||
Hash[String[1], Hash] $external_repo_details = $php::external_repo_details, | ||
) { | ||
assert_private() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should maybe "custom repo detail" or "repo config" or "repo settings" or simply "repository" (is it real relevant if it is a external or internal repository? isn't it "here we have custom repository config" (i can be the default debian repo where i only change a key hash)
should be a custom type like
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this work for every repo type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"yes" we would have to write a type for each repo stucture we want to support.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will add this type to the module