Skip to content

Commit

Permalink
properly handle float/integer values in app/system configuration
Browse files Browse the repository at this point in the history
Previously, these float/integer values were interpreted as strings, which could lead to unexpected behaviour in Nextcloud.
  • Loading branch information
fraenki committed Nov 6, 2024
1 parent c5eafcf commit 1a6642b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [UNRELEASED]

### Fixed
* Properly handle float/integer values in app/system configuration

## [v1.10.0] - 2023-08-01

### Changed
Expand Down
9 changes: 7 additions & 2 deletions manifests/config_command.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
# The configuration verify to find out whether it needs to be altered.
#
define nextcloud::config_command (
Variant[Boolean, Integer, String] $value,
Variant[Boolean, Float, Integer, String] $value,
Variant[Boolean, Integer, String] $verify_key,
Variant[Boolean, Integer, String] $verify_value,
Variant[Boolean, Float, Integer, String] $verify_value,
Variant[Boolean, Integer, String] $key = $title,
Enum['app', 'system'] $section = 'system',
) {
Expand All @@ -44,7 +44,12 @@
$_occ_cmd = "config:${section}:set"
if ($value =~ Boolean) {
$_occ_args = "${cfg_key} --value=${value} --type=boolean"
} elsif ($value =~ Integer) {
$_occ_args = "${cfg_key} --value=${value} --type=integer"
} elsif ($value =~ Float) {
$_occ_args = "${cfg_key} --value=${value} --type=float"
} else {
# Everything else is a string.
$_occ_args = "${cfg_key} --value=\'${value}\'"
}
$unless_cmd = join([
Expand Down

0 comments on commit 1a6642b

Please sign in to comment.