public inbox for pmg-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pmg-devel] [PATCH pmg-api] api: apt: repos: avoid creating implicit default for enabled
@ 2021-07-16 13:42 Fabian Ebner
  2021-07-19 15:42 ` [pmg-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Fabian Ebner @ 2021-07-16 13:42 UTC (permalink / raw)
  To: pmg-devel

The parameter is optional, so a check for definedness is needed before
converting to int.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
 src/PMG/API2/APT.pm | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/PMG/API2/APT.pm b/src/PMG/API2/APT.pm
index 6d0f651..5e132c4 100644
--- a/src/PMG/API2/APT.pm
+++ b/src/PMG/API2/APT.pm
@@ -749,9 +749,10 @@ __PACKAGE__->register_method({
     code => sub {
 	my ($param) = @_;
 
-	my $options = {
-	    enabled => int($param->{enabled}),
-	};
+	my $options = {};
+
+	my $enabled = $param->{enabled};
+	$options->{enabled} = int($enabled) if defined($enabled);
 
 	PMG::RS::APT::Repositories::change_repository(
 	    $param->{path},
-- 
2.30.2





^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pmg-devel] applied: [PATCH pmg-api] api: apt: repos: avoid creating implicit default for enabled
  2021-07-16 13:42 [pmg-devel] [PATCH pmg-api] api: apt: repos: avoid creating implicit default for enabled Fabian Ebner
@ 2021-07-19 15:42 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2021-07-19 15:42 UTC (permalink / raw)
  To: Fabian Ebner, pmg-devel

On 16.07.21 15:42, Fabian Ebner wrote:
> The parameter is optional, so a check for definedness is needed before
> converting to int.
> 
> Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
> ---
>  src/PMG/API2/APT.pm | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
>

applied, thanks!




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-19 15:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-16 13:42 [pmg-devel] [PATCH pmg-api] api: apt: repos: avoid creating implicit default for enabled Fabian Ebner
2021-07-19 15:42 ` [pmg-devel] applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal