GNU logs - #77019, boring messages


Message sent to ludo@HIDDEN, maxim.cournoyer@HIDDEN, roman@HIDDEN, guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#77019] [PATCH 0/1] machine: hetzner: Allow attaching existing public IPs.
Resent-From: Sergey Trofimov <sarg@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: ludo@HIDDEN, maxim.cournoyer@HIDDEN, roman@HIDDEN, guix-patches@HIDDEN
Resent-Date: Fri, 14 Mar 2025 19:18:02 +0000
Resent-Message-ID: <handler.77019.B.17419798602099 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 77019
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: 77019 <at> debbugs.gnu.org
Cc: Sergey Trofimov <sarg@HIDDEN>, Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>, Roman Scherer <roman@HIDDEN>
X-Debbugs-Original-To: guix-patches@HIDDEN
X-Debbugs-Original-Xcc: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>, Roman Scherer <roman@HIDDEN>
Received: via spool by submit <at> debbugs.gnu.org id=B.17419798602099
          (code B ref -1); Fri, 14 Mar 2025 19:18:02 +0000
Received: (at submit) by debbugs.gnu.org; 14 Mar 2025 19:17:40 +0000
Received: from localhost ([127.0.0.1]:36296 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ttAXM-0000Xm-23
	for submit <at> debbugs.gnu.org; Fri, 14 Mar 2025 15:17:40 -0400
Received: from lists.gnu.org ([2001:470:142::17]:58244)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <sarg@HIDDEN>) id 1ttAXJ-0000XS-B3
 for submit <at> debbugs.gnu.org; Fri, 14 Mar 2025 15:17:38 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <sarg@HIDDEN>) id 1ttAXA-0007pS-RW
 for guix-patches@HIDDEN; Fri, 14 Mar 2025 15:17:29 -0400
Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <sarg@HIDDEN>) id 1ttAX5-0004D3-7m
 for guix-patches@HIDDEN; Fri, 14 Mar 2025 15:17:28 -0400
Received: by mail-ed1-x535.google.com with SMTP id
 4fb4d7f45d1cf-5e66407963fso4224194a12.2
 for <guix-patches@HIDDEN>; Fri, 14 Mar 2025 12:17:20 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=sarg.org.ru; s=google; t=1741979837; x=1742584637; darn=gnu.org;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=/WZ5FbNcS4Ul1fW9a8yiecJaNl4rqku+Bd5wjtV6KUo=;
 b=LMN605d4dNXOLjR+dj69tZlqd0r9lqQlWuROmjbixd5IW4iDUiT4pfXfElf9r00V9R
 Y1Y6rDgP6n/oCr47jnCYloyBpRHprZ5u5+r9dvyByW3l6RrDCi3oE+3U2c7RxiBg/SBG
 uAieVOtl/sCLnpXm+ZNKaTD8h9JXZdqlEGfq0MII/Dr9XMTQp7F/4rcYmxdaYb0nnjxr
 ZOWpErF762iLaM9wCkouqo4vTJmgCTS+DwwtJjfpBp9oOpcdEUqJC25fZ17um9avB3u6
 oka60/xCWqITZa+0F69+KdCApAxsYcVULOgCGLPz0VlV1ridFg/YlDzkBRUR19iGgUa+
 N4Ww==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1741979837; x=1742584637;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=/WZ5FbNcS4Ul1fW9a8yiecJaNl4rqku+Bd5wjtV6KUo=;
 b=R3CWvEnpgguemz4YWxv3zxysatYEUNJ3Nire8Tc/oSNpIT1O5SSLgVU7hZBPK3JcjU
 SJ7azaP3nCXGkh7XRp8sZFWPSpL80PlcIlehzPh1PaTNrsoS74zOWpnWElMoKOHFH1z5
 4aUTJmX+ZoA2WXKHSszFTodRfaeRdtENB7TVgJ1KRlKrQDcESdg4QRFga7yKP0lYIA70
 Gt4N85lmUZZ47FBV1idtqFrrAEYS9FLwQYf7Mz2vQanm7m8skO0lJMIGkmhhZusbWBrk
 BlTtUowH5r1tHroZ4cknu/M2WuryRKdf6gg6f2VrliyodihZDwdbVDenqA0S1RT5CUIV
 Zvfw==
X-Gm-Message-State: AOJu0YxuXzaQm8Cyvjca3o32q++wo4zoE5/sDS6b7DO+u6hZ+6HpYvXO
 jnvVoBbYyFD0IvSXJ2o49Q963hmbpiFmwemzkk0nIqbvC+EM1c2ZeM0zmc/pluYq3xBydrZU+BU
 YveE=
X-Gm-Gg: ASbGncuBrLj4UdEJU0vmHmR464API/1y9mga/VGULjbglu/OeswFL2GNntcbEFZyy+Z
 ipINXZKwz5Ggp3W6JxDSYzuuvQJyWDH7ZRwLvdl4lVBHSw6K+oc1z9ag9+4TKxgb3TFnQkDghHT
 1QTv+oIKbXmFiXOGTgJjMGW5Ky5Tiv0Md7KwAJdSbkh1RbBqBl7acvpLC7hEJju+s5x2GGGfPLS
 zm9TKPbkgpaadOB/5UXxP1cE7u3eq2bwRVXXcw8k8wt16MTkbmL0xw1b5qvdwxRoGNEsk6kPOEa
 yK4vKQDGxa15ASxDhJiJtB7BScrHGEoK64Hb5eldUA==
X-Google-Smtp-Source: AGHT+IGQRU5orZqnVQB4LBHimFPWTqg39jW0WbzK3OJ0c80QIRlX5hyH7+13CzUtUEAbY//uU5Dcuw==
X-Received: by 2002:a05:6402:3550:b0:5dc:cfc5:9305 with SMTP id
 4fb4d7f45d1cf-5e8a04269acmr4201365a12.25.1741979836230; 
 Fri, 14 Mar 2025 12:17:16 -0700 (PDT)
Received: from localhost ([2a02:2454:a0a5:2400:a64e:31ff:fe38:fd6c])
 by smtp.gmail.com with ESMTPSA id
 4fb4d7f45d1cf-5e816afdfdbsm2256540a12.74.2025.03.14.12.17.14
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 14 Mar 2025 12:17:15 -0700 (PDT)
From: Sergey Trofimov <sarg@HIDDEN>
Date: Fri, 14 Mar 2025 20:17:11 +0100
Message-ID: <cover.1741979546.git.sarg@HIDDEN>
X-Mailer: git-send-email 2.48.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Received-SPF: pass client-ip=2a00:1450:4864:20::535;
 envelope-from=sarg@HIDDEN; helo=mail-ed1-x535.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.7 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview: This patch allows attaching existing IP addresses to hetzner
 VMs. Use it when a static IP address is necessary on the VM. While testing
 it I've found out that `guile-json` doesn't support nullable fields, so it
 is not possible to disable v4 or v6 addresses currently (e.g. `(ipv4 #f)`).
 See https://github.com/aconchillo/g [...] 
 Content analysis details:   (1.7 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.1 URIBL_SBL_A Contains URL's A record listed in the Spamhaus SBL
 blocklist [URIs: sarg.org.ru]
 0.6 URIBL_SBL Contains an URL's NS IP listed in the Spamhaus SBL
 blocklist [URIs: sarg.org.ru]
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
 no trust [2001:470:142:0:0:0:0:17 listed in] [list.dnswl.org]
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
 1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.7 (/)

This patch allows attaching existing IP addresses to hetzner VMs. Use it when
a static IP address is necessary on the VM.

While testing it I've found out that `guile-json` doesn't support nullable
fields, so it is not possible to disable v4 or v6 addresses currently
(e.g. `(ipv4 #f)`). See https://github.com/aconchillo/guile-json/issues/87 for
details.

Sergey Trofimov (1):
  machine: hetzner: Allow attaching existing public IPs.

 doc/guix.texi                | 10 ++++++++++
 gnu/machine/hetzner.scm      | 25 +++++++++++++++++++++++++
 gnu/machine/hetzner/http.scm | 35 +++++++++++++++++++++++++++++------
 3 files changed, 64 insertions(+), 6 deletions(-)


base-commit: 9449ab3c2025820d2e6fd679fa7e34832b667ea7
-- 
2.48.1





Message sent:


Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.505 (Entity 5.505)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: Sergey Trofimov <sarg@HIDDEN>
Subject: bug#77019: Acknowledgement ([PATCH 0/1] machine: hetzner: Allow
 attaching existing public IPs.)
Message-ID: <handler.77019.B.17419798602099.ack <at> debbugs.gnu.org>
References: <cover.1741979546.git.sarg@HIDDEN>
X-Gnu-PR-Message: ack 77019
X-Gnu-PR-Package: guix-patches
X-Gnu-PR-Keywords: patch
Reply-To: 77019 <at> debbugs.gnu.org
Date: Fri, 14 Mar 2025 19:18:02 +0000

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

As you requested using X-Debbugs-CC, your message was also forwarded to
  Ludovic Court=C3=A8s <ludo@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@gma=
il.com>, Roman Scherer <roman@HIDDEN>
(after having been given a bug report number, if it did not have one).

Your message has been sent to the package maintainer(s):
 guix-patches@HIDDEN

If you wish to submit further information on this problem, please
send it to 77019 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

--=20
77019: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D77019
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems


Message sent to sarg@HIDDEN, ludo@HIDDEN, maxim.cournoyer@HIDDEN, roman@HIDDEN, guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#77019] [PATCH] machine: hetzner: Allow attaching existing public IPs.
References: <cover.1741979546.git.sarg@HIDDEN>
In-Reply-To: <cover.1741979546.git.sarg@HIDDEN>
Resent-From: Sergey Trofimov <sarg@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: sarg@HIDDEN, ludo@HIDDEN, maxim.cournoyer@HIDDEN, roman@HIDDEN, guix-patches@HIDDEN
Resent-Date: Fri, 14 Mar 2025 19:47:02 +0000
Resent-Message-ID: <handler.77019.B77019.17419815998002 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 77019
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: 77019 <at> debbugs.gnu.org
Cc: Sergey Trofimov <sarg@HIDDEN>, Sergey Trofimov <sarg@HIDDEN>, Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>, Roman Scherer <roman@HIDDEN>
X-Debbugs-Original-Xcc: Sergey Trofimov <sarg@HIDDEN>, Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>, Roman Scherer <roman@HIDDEN>
Received: via spool by 77019-submit <at> debbugs.gnu.org id=B77019.17419815998002
          (code B ref 77019); Fri, 14 Mar 2025 19:47:02 +0000
Received: (at 77019) by debbugs.gnu.org; 14 Mar 2025 19:46:39 +0000
Received: from localhost ([127.0.0.1]:36351 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ttAzK-00024q-D6
	for submit <at> debbugs.gnu.org; Fri, 14 Mar 2025 15:46:38 -0400
Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]:43098)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <sarg@HIDDEN>) id 1ttAzG-00024T-6H
 for 77019 <at> debbugs.gnu.org; Fri, 14 Mar 2025 15:46:32 -0400
Received: by mail-ej1-x635.google.com with SMTP id
 a640c23a62f3a-ac297cbe017so644989866b.0
 for <77019 <at> debbugs.gnu.org>; Fri, 14 Mar 2025 12:46:30 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=sarg.org.ru; s=google; t=1741981583; x=1742586383; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=Hg1xQj8MfgZXpcXeoqwM5WTGx071dplv/GKTJxlYHZg=;
 b=pWnoTaStN+WaN3B50qQi0wY8wsZv9QNl0UzhZZhxXLRMggfMBWJ95u33iDvh82zMtw
 s+0fkYY1aFD44hzPIzX2bmBKJkff+OOaWvCmPHfy/aJ9FsyhOwqrsUmgw2rg17n2shFo
 DQzte66NT/FOU7wNpEFyZDNPPzUEVIXuRa/5cMlZLn5tteqOe677AWo2e9XPo8Q/rVQS
 xsAfII79HRHEwsXfIbMI7PEKYMjUMFR7ErQwJqoSWnUHC5sAWLluWewwzgzKxjlBcxNC
 Nbz2BCiiKqGYIprXalThffJAvxXKC/kZ7mtK4AcaImq1NW1f0zoumDmSg27PEvhMpLiY
 lUCg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1741981583; x=1742586383;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=Hg1xQj8MfgZXpcXeoqwM5WTGx071dplv/GKTJxlYHZg=;
 b=G/o59vm7Iun/PFkTZDQ8opVTETgpRFBjcBM5a5y3UqKH7Rmpw7AZG8nz3s1qon/7ms
 +Y1GuHiFWpGw62hR3fGedU/qC5ZQEsToMp5CG3BycFWYhq7kQfvqaLpOK3Wbt6/RMA5A
 HXrdGxw5DU6Xy4gLTfomQl17T0Z0xJlEJO2ejGTtx1ebhGkwaXpbWkDtMK+ZivsWEhcI
 3UEJdXY1wtlc3+gIp7DN/PYXdagm/NhErsfAoJpnfdYVWvROtJrmZ2kFs6KZ+7xLyeE8
 z9c3bVvEFX47dDFHVkIH/vX/pqYksYYCcuVUya59gNa6FS8zpLuTryvlvku3tdXjcGzO
 fg0Q==
X-Gm-Message-State: AOJu0YzoEKRWgpOq1tnf+yzJ2Ojj31uq3LKpw6E+Ego61evtA0d/qNL3
 We/Sue6LrjIwQ5EqNEg8lTD1oIIB1AhoaDcF9T5lagnzUjX3HwIC2KCtiFjkbUknxodnnYr/ig9
 oc58=
X-Gm-Gg: ASbGncvY7D/UqtDgJPYqJWNM1ljpCQv7eEU0PfdDlxpP9SG9fYuxp3tZpKuwjOaML/D
 BP5ZM9PxTHdmkJGPlhLNwfXaGIyNa7yk5X0P9cznLbwjvVz6P0AOCkARbjtVa/75JI0TpQGet5i
 9bpTahP51uxqmY+XpeJ4+13hrQ8wojEZQ8/wt5XPeVEThZGu5+UbLEU0pnqnyLI/Xkp5FDhxiA8
 vgHXyzk5Hwnh20BX5u26nVj0isTeoKJ9tf8x/9qF9z4ne+JXe/D+udn8pLrr3+sQ0VMaxVWIFUy
 BnLedZzsvyFF5kDPEf4y0WYeDwyWx9dVb3M/Z/Mu/YJjn/42b92A
X-Google-Smtp-Source: AGHT+IFT5FSz7nP3N4wMGmVSUE9x4qVvYzqO/PvDs/p9ijwf86VCZJ3X8ZSvmEBKhKXH4qMV4oOwHA==
X-Received: by 2002:a17:907:7fa6:b0:abf:742e:1fde with SMTP id
 a640c23a62f3a-ac331377bf4mr431426966b.14.1741981582690; 
 Fri, 14 Mar 2025 12:46:22 -0700 (PDT)
Received: from localhost ([2a02:2454:a0a5:2400:a64e:31ff:fe38:fd6c])
 by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-ac3147f142fsm266414266b.64.2025.03.14.12.46.21
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 14 Mar 2025 12:46:22 -0700 (PDT)
From: Sergey Trofimov <sarg@HIDDEN>
Date: Fri, 14 Mar 2025 20:46:16 +0100
Message-ID: <9f04c5e5955ef1115effce2f3b332091ec149b2a.1741981547.git.sarg@HIDDEN>
X-Mailer: git-send-email 2.48.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.7 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.3 (/)

* gnu/machine/hetzner.scm (hetzner-configuration): Add ipv4 and ipv6
fields. Export accessors.
* gnu/machine/hetzner/http.scm (hetnzer-api-primary-ips): New function.
(<hetzner-primary-ip>): New json mapping.
(hetzner-api-server-create): Pass IP addresses in request.
* doc/guix.texi: Document it.
---
 doc/guix.texi                | 10 ++++++++++
 gnu/machine/hetzner.scm      | 25 +++++++++++++++++++++++++
 gnu/machine/hetzner/http.scm | 35 +++++++++++++++++++++++++++++------
 3 files changed, 64 insertions(+), 6 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 49ac018913..4a35f3ea13 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -45919,6 +45919,16 @@ Invoking guix deploy
 provisioning phase. If false, the server will be kept in order to debug
 any issues.
 
+@item @code{ipv4} (default: @code{'create})
+When false, no public IPv4 address is going to be attached. Specify the
+name of an existing primary ip to attach it to the machine. Other values
+would create a new address automatically.
+
+@item @code{ipv6} (default: @code{'create})
+When false, no public IPv6 address is going to be attached. Specify the
+name of an existing primary ip to attach it to the machine. Other values
+would create a new address automatically.
+
 @item @code{labels} (default: @code{'()})
 A user defined alist of key/value pairs attached to the SSH key and the
 server on the Hetzner API.  Keys and values must be strings,
diff --git a/gnu/machine/hetzner.scm b/gnu/machine/hetzner.scm
index e8484e4d51..c1ccab54ae 100644
--- a/gnu/machine/hetzner.scm
+++ b/gnu/machine/hetzner.scm
@@ -73,6 +73,8 @@ (define-module (gnu machine hetzner)
             hetzner-configuration-authorize?
             hetzner-configuration-build-locally?
             hetzner-configuration-delete?
+            hetzner-configuration-ipv4
+            hetzner-configuration-ipv6
             hetzner-configuration-labels
             hetzner-configuration-location
             hetzner-configuration-server-type
@@ -205,6 +207,10 @@ (define-record-type* <hetzner-configuration> hetzner-configuration
             (default "fsn1"))
   (server-type hetzner-configuration-server-type ; string
                (default "cx42"))
+  (ipv4 hetzner-configuration-ipv4
+        (default 'create))
+  (ipv6 hetzner-configuration-ipv6
+        (default 'create))
   (ssh-public-key hetzner-configuration-ssh-public-key ; public-key | string
                   (thunked)
                   (default (public-key-from-file (hetzner-configuration-ssh-key this-hetzner-configuration)))
@@ -445,6 +451,17 @@ (define (hetzner-machine-server machine)
            (hetzner-configuration-api config)
            #:params `(("name" . ,(machine-display-name machine)))))))
 
+(define (hetzner-resolve-ip api name)
+  "Find the NAME IP address on the Hetzner API."
+  (or
+   (find (lambda (primary-ip)
+           (equal? name (hetzner-primary-ip-name primary-ip)))
+         (hetzner-api-primary-ips api #:params `(("name" . ,name))))
+
+   (raise-exception
+    (formatted-message (G_ "primary ip '~a' does not exist.")
+                       name))))
+
 (define (hetzner-machine-create-server machine)
   "Create the Hetzner server for MACHINE."
   (let* ((config (machine-configuration machine))
@@ -452,11 +469,19 @@ (define (hetzner-machine-create-server machine)
          (server-type (hetzner-configuration-server-type config)))
     (format #t "creating '~a' server for '~a'...\n" server-type name)
     (let* ((ssh-key (hetzner-machine-ssh-key machine))
+           (ipv4 (hetzner-configuration-ipv4 config))
+           (ipv6 (hetzner-configuration-ipv6 config))
            (api (hetzner-configuration-api config))
            (server (hetzner-api-server-create
                     api
                     (machine-display-name machine)
                     (list ssh-key)
+                    #:ipv4 (if (string? ipv4)
+                               (hetzner-primary-ip-id (hetzner-resolve-ip api ipv4))
+                               ipv4)
+                    #:ipv6 (if (string? ipv6)
+                               (hetzner-primary-ip-id (hetzner-resolve-ip api ipv6))
+                               ipv4)
                     #:labels (hetzner-configuration-labels config)
                     #:location (hetzner-configuration-location config)
                     #:server-type (hetzner-configuration-server-type config)))
diff --git a/gnu/machine/hetzner/http.scm b/gnu/machine/hetzner/http.scm
index 51b4bff984..6a82558fbe 100644
--- a/gnu/machine/hetzner/http.scm
+++ b/gnu/machine/hetzner/http.scm
@@ -52,6 +52,7 @@ (define-module (gnu machine hetzner http)
             hetzner-api-actions
             hetzner-api-create-ssh-key
             hetzner-api-locations
+            hetzner-api-primary-ips
             hetzner-api-request-body
             hetzner-api-request-headers
             hetzner-api-request-method
@@ -100,6 +101,13 @@ (define-module (gnu machine hetzner http)
             hetzner-location-name
             hetzner-location-network-zone
             hetzner-location?
+            hetzner-primary-ip
+            hetzner-primary-ip-created
+            hetzner-primary-ip-id
+            hetzner-primary-ip-ip
+            hetzner-primary-ip-labels
+            hetzner-primary-ip-name
+            hetzner-primary-ip-type
             hetzner-public-net
             hetzner-public-net-ipv4
             hetzner-public-net-ipv6
@@ -296,6 +304,15 @@ (define-json-mapping <hetzner-server-type>
   (name hetzner-server-type-name) ; string
   (storage-type hetzner-server-type-storage-type "storage_type")) ; string
 
+(define-json-mapping <hetzner-primary-ip>
+  make-hetzner-primary-ip hetzner-primary-ip? json->hetzner-primary-ip
+  (created hetzner-primary-ip-created "created" string->time) ; time
+  (id hetzner-primary-ip-id) ; integer
+  (ip hetzner-primary-ip-ip) ; string
+  (labels hetzner-primary-ip-labels) ; alist of string/string
+  (name hetzner-primary-ip-name) ; string
+  (type hetzner-primary-ip-type))  ; string
+
 (define-json-mapping <hetzner-ssh-key>
   make-hetzner-ssh-key hetzner-ssh-key? json->hetzner-ssh-key
   (created hetzner-ssh-key-created "created" string->time) ; time
@@ -581,12 +598,11 @@ (define* (hetzner-api-locations api . options)
 (define* (hetzner-api-server-create
           api name ssh-keys
           #:key
-          (enable-ipv4? #t)
-          (enable-ipv6? #t)
+          (ipv4 #f)
+          (ipv6 #f)
           (image %hetzner-default-server-image)
           (labels '())
           (location %hetzner-default-server-location)
-          (public-net #f)
           (server-type %hetzner-default-server-type)
           (start-after-create? #f))
   "Create a server with the Hetzner API."
@@ -595,9 +611,11 @@ (define* (hetzner-api-server-create
                #:body `(("image" . ,image)
                         ("labels" . ,labels)
                         ("name" . ,name)
-                        ("public_net"
-                         . (("enable_ipv4" . ,enable-ipv4?)
-                            ("enable_ipv6" . ,enable-ipv6?)))
+                        ("public_net" .
+                         (("enable_ipv4" . ,(and ipv4 #t))
+                          ("enable_ipv6" . ,(and ipv6 #t))
+                          ,@(if (integer? ipv4) `(("ipv4" . ,ipv4)) '())
+                          ,@(if (integer? ipv6) `(("ipv6" . ,ipv6)) '())))
                         ("location" . ,location)
                         ("server_type" . ,server-type)
                         ("ssh_keys" . ,(apply vector (map hetzner-ssh-key-id ssh-keys)))
@@ -658,6 +676,11 @@ (define* (hetzner-api-ssh-keys api . options)
   (apply hetzner-api-list api "/ssh_keys" "ssh_keys"
          json->hetzner-ssh-key options))
 
+(define* (hetzner-api-primary-ips api . options)
+  "Get Primary IPs from the Hetzner API."
+  (apply hetzner-api-list api "/primary_ips" "primary_ips"
+         json->hetzner-primary-ip options))
+
 (define* (hetzner-api-server-types api . options)
   "Get server types from the Hetzner API."
   (apply hetzner-api-list api "/server_types" "server_types"

base-commit: 412f411d4f8780e6b60b448caae17f01c09be0eb
--
2.48.1





Message sent to sarg@HIDDEN, ludo@HIDDEN, maxim.cournoyer@HIDDEN, guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#77019] [PATCH v1] machine: hetzner: Allow attaching existing public IPs.
References: <cover.1741979546.git.sarg@HIDDEN>
In-Reply-To: <cover.1741979546.git.sarg@HIDDEN>
Resent-From: Sergey Trofimov <sarg@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: sarg@HIDDEN, ludo@HIDDEN, maxim.cournoyer@HIDDEN, guix-patches@HIDDEN
Resent-Date: Thu, 20 Mar 2025 06:51:02 +0000
Resent-Message-ID: <handler.77019.B77019.17424534346818 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 77019
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: 77019 <at> debbugs.gnu.org
Cc: Sergey Trofimov <sarg@HIDDEN>, Sergey Trofimov <sarg@HIDDEN>, Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>
X-Debbugs-Original-Xcc: Sergey Trofimov <sarg@HIDDEN>, Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>
Received: via spool by 77019-submit <at> debbugs.gnu.org id=B77019.17424534346818
          (code B ref 77019); Thu, 20 Mar 2025 06:51:02 +0000
Received: (at 77019) by debbugs.gnu.org; 20 Mar 2025 06:50:34 +0000
Received: from localhost ([127.0.0.1]:54978 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tv9jd-0001lt-8v
	for submit <at> debbugs.gnu.org; Thu, 20 Mar 2025 02:50:33 -0400
Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]:44112)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <sarg@HIDDEN>) id 1tv9jZ-0001lb-N8
 for 77019 <at> debbugs.gnu.org; Thu, 20 Mar 2025 02:50:31 -0400
Received: by mail-ej1-x631.google.com with SMTP id
 a640c23a62f3a-ac2ed007aacso108278066b.0
 for <77019 <at> debbugs.gnu.org>; Wed, 19 Mar 2025 23:50:29 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=sarg.org.ru; s=google; t=1742453423; x=1743058223; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=Kw81YzkTPQHFS9zHq7GpiX0BN4jLBIUnXyxgxrW4Kgg=;
 b=t7lwk7X54q6ZPtS53BdKr3srZFjkbtdLTssa6HPlMcjdW1fk4gc1s/9LciNoA3LVQp
 d3D4SzJtW/xAd4jN334P4RnNIhcg+O3wfzDKEy5NTngN3Gei4hLwB/Z8nlyCD1u4MZ7Z
 vS8BXUegCsqf5d2GY8Y11lzr5wFsjqU7sCfNPSbuQEG/OzW7bmpjpgVnBq59WuPYIMoQ
 qdlC1Ofjr1yx0h6RZXUwJYy1CmucMW907k0JjQuigr58k/1G/FD59XOdkJle4Oa7d57M
 csXwveqBP6I3y2mt7sNT4hBxvB7wQtenoRHyQQunslQkjqYGp8EtYL4aSibD8SchANr5
 lvbg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1742453423; x=1743058223;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=Kw81YzkTPQHFS9zHq7GpiX0BN4jLBIUnXyxgxrW4Kgg=;
 b=Q+u5vbxAGiYvSSnjKgv2DN3itnWNVQTU0HHSqU8hypofrz/IN0d3M2CQRr96w7ukMS
 4I8TgQ0eTkpIUaGtng3jLv8oY7SrnkKtNG3ZXXxbiLYRmhkf1pdNkpFXN4beDKgv/vAE
 N6/6sZF5fK+qthdcozd1W7BhEPXs6jzJP8YAEf0CFuyB6QqayL4wIS9xbWIzFF3ECd2f
 gZDBK2R8fC482uH25Q8bAtG7kZ1LpC/xb9iGG6zkXtgnptFK/n8ffnFMUZV3zmFURjEY
 0kyHh1ikhfHCq5i/VS4KQJSqKhI+Imh1lv4jy/ywdBgDI/F/72c77y1hu+sDSIV/Fbok
 v4LQ==
X-Gm-Message-State: AOJu0YxB4qaVzI1lkTx62qEizBN2WeDvJTdyl6NhDfCykHZQMGSR2XwW
 3eo+R1EnyqEEAzGVGXHqoYtoiiTwz183onDFxbmrKMgXMtyT/Pej6XDXmUcag1LqguXhHI72ar0
 zQhI=
X-Gm-Gg: ASbGncvCW9xj7oolIUGypNZFX61ggZXXZuVVot6Ez01Rgs3uM91LvoiKYpS3mD73k4k
 EGmKrzSXx36ZJcQNnEefzmSmDFZxV2kni+jIULbAB4U5AbE0ND/AWZI3lb2z1tb3Q0ZhsddHAOk
 RZrsuj7JZFnymxlXeNeODgOFXwyVcolgHQhYsjhOY8DYijXfIPWRJYaTcK07hRp7fr0kdtnVpKC
 +KqtPJVpVS4bCHYxA7ZMr+s8MdfpEm57I041+SC4bz82apely8zXHaPYAzOA3PGHYgMuvkc8jkh
 10H+zVZW9yocTcjLABFAEAR+lA4yAEB9hvq2n1MvtQ==
X-Google-Smtp-Source: AGHT+IERm/7ba5lXQbpJbq0VogoTgjyCzlUtgBf+Pbv1sBA3i7hS7beqizMBCiuswLB7qBp0UnAtnQ==
X-Received: by 2002:a17:907:6ea9:b0:ac2:dc00:b34d with SMTP id
 a640c23a62f3a-ac3b7ff500cmr588956066b.53.1742453422880; 
 Wed, 19 Mar 2025 23:50:22 -0700 (PDT)
Received: from localhost ([2a02:2454:a0a5:2400:a64e:31ff:fe38:fd6c])
 by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-ac3b2b94da0sm240170066b.148.2025.03.19.23.50.22
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 19 Mar 2025 23:50:22 -0700 (PDT)
From: Sergey Trofimov <sarg@HIDDEN>
Date: Thu, 20 Mar 2025 07:50:18 +0100
Message-ID: <a2074b0b0bd1788f890f9ddb60cd697acc8b1d0a.1742453401.git.sarg@HIDDEN>
X-Mailer: git-send-email 2.48.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.7 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.3 (/)

* gnu/machine/hetzner.scm (hetzner-configuration): Add ipv4 and ipv6
fields. Export accessors.
* gnu/machine/hetzner/http.scm (hetnzer-api-primary-ips): New function.
(<hetzner-primary-ip>): New json mapping.
(hetzner-api-server-create): Pass IP addresses in request.
* doc/guix.texi: Document it.
---
 doc/guix.texi                  | 10 +++++++++
 gnu/machine/hetzner.scm        | 25 ++++++++++++++++++++++
 gnu/machine/hetzner/http.scm   | 36 ++++++++++++++++++++++++++------
 tests/machine/hetzner/http.scm | 38 ++++++++++++++++++++++++++++++++++
 4 files changed, 103 insertions(+), 6 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index e5894931ff..9352c56563 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -45962,6 +45962,16 @@ Invoking guix deploy
 provisioning phase. If false, the server will be kept in order to debug
 any issues.
 
+@item @code{ipv4} (default: @code{'create})
+When false, no public IPv4 address is going to be attached. Specify the
+name of an existing primary ip to attach it to the machine. Other values
+would create a new address automatically.
+
+@item @code{ipv6} (default: @code{'create})
+When false, no public IPv6 address is going to be attached. Specify the
+name of an existing primary ip to attach it to the machine. Other values
+would create a new address automatically.
+
 @item @code{labels} (default: @code{'()})
 A user defined alist of key/value pairs attached to the SSH key and the
 server on the Hetzner API.  Keys and values must be strings,
diff --git a/gnu/machine/hetzner.scm b/gnu/machine/hetzner.scm
index e8484e4d51..c1ccab54ae 100644
--- a/gnu/machine/hetzner.scm
+++ b/gnu/machine/hetzner.scm
@@ -73,6 +73,8 @@ (define-module (gnu machine hetzner)
             hetzner-configuration-authorize?
             hetzner-configuration-build-locally?
             hetzner-configuration-delete?
+            hetzner-configuration-ipv4
+            hetzner-configuration-ipv6
             hetzner-configuration-labels
             hetzner-configuration-location
             hetzner-configuration-server-type
@@ -205,6 +207,10 @@ (define-record-type* <hetzner-configuration> hetzner-configuration
             (default "fsn1"))
   (server-type hetzner-configuration-server-type ; string
                (default "cx42"))
+  (ipv4 hetzner-configuration-ipv4
+        (default 'create))
+  (ipv6 hetzner-configuration-ipv6
+        (default 'create))
   (ssh-public-key hetzner-configuration-ssh-public-key ; public-key | string
                   (thunked)
                   (default (public-key-from-file (hetzner-configuration-ssh-key this-hetzner-configuration)))
@@ -445,6 +451,17 @@ (define (hetzner-machine-server machine)
            (hetzner-configuration-api config)
            #:params `(("name" . ,(machine-display-name machine)))))))
 
+(define (hetzner-resolve-ip api name)
+  "Find the NAME IP address on the Hetzner API."
+  (or
+   (find (lambda (primary-ip)
+           (equal? name (hetzner-primary-ip-name primary-ip)))
+         (hetzner-api-primary-ips api #:params `(("name" . ,name))))
+
+   (raise-exception
+    (formatted-message (G_ "primary ip '~a' does not exist.")
+                       name))))
+
 (define (hetzner-machine-create-server machine)
   "Create the Hetzner server for MACHINE."
   (let* ((config (machine-configuration machine))
@@ -452,11 +469,19 @@ (define (hetzner-machine-create-server machine)
          (server-type (hetzner-configuration-server-type config)))
     (format #t "creating '~a' server for '~a'...\n" server-type name)
     (let* ((ssh-key (hetzner-machine-ssh-key machine))
+           (ipv4 (hetzner-configuration-ipv4 config))
+           (ipv6 (hetzner-configuration-ipv6 config))
            (api (hetzner-configuration-api config))
            (server (hetzner-api-server-create
                     api
                     (machine-display-name machine)
                     (list ssh-key)
+                    #:ipv4 (if (string? ipv4)
+                               (hetzner-primary-ip-id (hetzner-resolve-ip api ipv4))
+                               ipv4)
+                    #:ipv6 (if (string? ipv6)
+                               (hetzner-primary-ip-id (hetzner-resolve-ip api ipv6))
+                               ipv4)
                     #:labels (hetzner-configuration-labels config)
                     #:location (hetzner-configuration-location config)
                     #:server-type (hetzner-configuration-server-type config)))
diff --git a/gnu/machine/hetzner/http.scm b/gnu/machine/hetzner/http.scm
index 51b4bff984..33f501f53a 100644
--- a/gnu/machine/hetzner/http.scm
+++ b/gnu/machine/hetzner/http.scm
@@ -52,6 +52,7 @@ (define-module (gnu machine hetzner http)
             hetzner-api-actions
             hetzner-api-create-ssh-key
             hetzner-api-locations
+            hetzner-api-primary-ips
             hetzner-api-request-body
             hetzner-api-request-headers
             hetzner-api-request-method
@@ -100,6 +101,13 @@ (define-module (gnu machine hetzner http)
             hetzner-location-name
             hetzner-location-network-zone
             hetzner-location?
+            hetzner-primary-ip
+            hetzner-primary-ip-created
+            hetzner-primary-ip-id
+            hetzner-primary-ip-ip
+            hetzner-primary-ip-labels
+            hetzner-primary-ip-name
+            hetzner-primary-ip-type
             hetzner-public-net
             hetzner-public-net-ipv4
             hetzner-public-net-ipv6
@@ -144,6 +152,7 @@ (define-module (gnu machine hetzner http)
             make-hetzner-ipv6
             make-hetzner-location
             make-hetzner-public-net
+            make-hetzner-primary-ip
             make-hetzner-resource
             make-hetzner-server
             make-hetzner-server-type
@@ -296,6 +305,15 @@ (define-json-mapping <hetzner-server-type>
   (name hetzner-server-type-name) ; string
   (storage-type hetzner-server-type-storage-type "storage_type")) ; string
 
+(define-json-mapping <hetzner-primary-ip>
+  make-hetzner-primary-ip hetzner-primary-ip? json->hetzner-primary-ip
+  (created hetzner-primary-ip-created "created" string->time) ; time
+  (id hetzner-primary-ip-id) ; integer
+  (ip hetzner-primary-ip-ip) ; string
+  (labels hetzner-primary-ip-labels) ; alist of string/string
+  (name hetzner-primary-ip-name) ; string
+  (type hetzner-primary-ip-type))  ; string
+
 (define-json-mapping <hetzner-ssh-key>
   make-hetzner-ssh-key hetzner-ssh-key? json->hetzner-ssh-key
   (created hetzner-ssh-key-created "created" string->time) ; time
@@ -581,12 +599,11 @@ (define* (hetzner-api-locations api . options)
 (define* (hetzner-api-server-create
           api name ssh-keys
           #:key
-          (enable-ipv4? #t)
-          (enable-ipv6? #t)
+          (ipv4 #f)
+          (ipv6 #f)
           (image %hetzner-default-server-image)
           (labels '())
           (location %hetzner-default-server-location)
-          (public-net #f)
           (server-type %hetzner-default-server-type)
           (start-after-create? #f))
   "Create a server with the Hetzner API."
@@ -595,9 +612,11 @@ (define* (hetzner-api-server-create
                #:body `(("image" . ,image)
                         ("labels" . ,labels)
                         ("name" . ,name)
-                        ("public_net"
-                         . (("enable_ipv4" . ,enable-ipv4?)
-                            ("enable_ipv6" . ,enable-ipv6?)))
+                        ("public_net" .
+                         (("enable_ipv4" . ,(and ipv4 #t))
+                          ("enable_ipv6" . ,(and ipv6 #t))
+                          ,@(if (integer? ipv4) `(("ipv4" . ,ipv4)) '())
+                          ,@(if (integer? ipv6) `(("ipv6" . ,ipv6)) '())))
                         ("location" . ,location)
                         ("server_type" . ,server-type)
                         ("ssh_keys" . ,(apply vector (map hetzner-ssh-key-id ssh-keys)))
@@ -658,6 +677,11 @@ (define* (hetzner-api-ssh-keys api . options)
   (apply hetzner-api-list api "/ssh_keys" "ssh_keys"
          json->hetzner-ssh-key options))
 
+(define* (hetzner-api-primary-ips api . options)
+  "Get Primary IPs from the Hetzner API."
+  (apply hetzner-api-list api "/primary_ips" "primary_ips"
+         json->hetzner-primary-ip options))
+
 (define* (hetzner-api-server-types api . options)
   "Get server types from the Hetzner API."
   (apply hetzner-api-list api "/server_types" "server_types"
diff --git a/tests/machine/hetzner/http.scm b/tests/machine/hetzner/http.scm
index 618d9a4c94..6c6d848a57 100644
--- a/tests/machine/hetzner/http.scm
+++ b/tests/machine/hetzner/http.scm
@@ -239,6 +239,30 @@ (define server-x86-alist
     ("status" . "running")
     ("volumes" . #())))
 
+(define primary-ip
+  (make-hetzner-primary-ip
+   #(55 2 19 28 9 123 6 300 -1 0 #f)
+   42
+   "131.232.99.1"
+   '()
+   "static-ip"
+   "ipv4"))
+
+(define primary-ip-alist
+  `(("created" . "2023-10-28T19:02:55+00:00")
+    ("id" . 42)
+    ("labels")
+    ("name" . "static-ip")
+    ("blocked" . #f)
+    ("ip" . "131.232.99.1")
+    ("datacenter")
+    ("dns_ptr")
+    ("protection" . (("delete" . #f)))
+    ("type" . "ipv4")
+    ("auto_delete" . #t)
+    ("assignee_type" . "server")
+    ("assignee_id" . 17)))
+
 (define ssh-key-root
   (make-hetzner-ssh-key
    #(55 2 19 28 9 123 6 300 -1 0 #f)
@@ -512,6 +536,20 @@ (define-syntax-rule (with-cleanup-api (api-sym api-init) body ...)
                     ("ssh_keys" . #(,ssh-key-root-alist)))))))
         (hetzner-api-ssh-keys (hetzner-api))))
 
+(test-equal "hetzner-api-primary-ips-unit"
+  (list primary-ip)
+  (mock ((gnu machine hetzner http) hetzner-api-request-send
+         (lambda* (request #:key expected)
+           (assert (equal? 'GET (hetzner-api-request-method request)))
+           (assert (equal? "https://api.hetzner.cloud/v1/primary_ips"
+                           (hetzner-api-request-url request)))
+           (assert (unspecified? (hetzner-api-request-body request)))
+           (assert (equal? '(("page" . 1)) (hetzner-api-request-params request)))
+           (hetzner-api-response
+            (body `(("meta" . ,meta-page-alist)
+                    ("primary_ips" . #(,primary-ip-alist)))))))
+        (hetzner-api-primary-ips (hetzner-api))))
+
 ;; Integration tests
 
 (test-skip %when-no-token)

base-commit: 77ff73a920759437639e8eb77601e51409fefefa
prerequisite-patch-id: f9cc903b8048c8c6fde576fbf38ab110263020e3
prerequisite-patch-id: 220ddf11addf3a6c7ab3b349077bca6849241556
-- 
2.48.1





Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#77019] [PATCH 0/1] machine: hetzner: Allow attaching existing public IPs.
Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Thu, 17 Apr 2025 20:54:04 +0000
Resent-Message-ID: <handler.77019.B77019.174492323215224 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 77019
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: Sergey Trofimov <sarg@HIDDEN>
Cc: Roman Scherer <roman@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>, 77019 <at> debbugs.gnu.org
Received: via spool by 77019-submit <at> debbugs.gnu.org id=B77019.174492323215224
          (code B ref 77019); Thu, 17 Apr 2025 20:54:04 +0000
Received: (at 77019) by debbugs.gnu.org; 17 Apr 2025 20:53:52 +0000
Received: from localhost ([127.0.0.1]:48664 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1u5WF4-0003xE-Ne
	for submit <at> debbugs.gnu.org; Thu, 17 Apr 2025 16:53:51 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:52632)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <ludo@HIDDEN>) id 1u5WEW-0003qE-DA
 for 77019 <at> debbugs.gnu.org; Thu, 17 Apr 2025 16:53:18 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1u5WEP-0007RS-JE; Thu, 17 Apr 2025 16:53:09 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=jvLZ/hrShyP7j/U4FJvydBVAMtIIVH34ydgF5i4Jd0M=; b=BmrQGvHEpNroER0uN9t0
 ek8PITKWzPRYCCp+YcZOY0xFWlqoBdUuad5O6jpm6LYOva8XXqQBEiYnPHiU4Dtd2wlGCbK6xvQqM
 RR85HWOKfyuxGgAjT7sWFU04vCxSFlNFlNRoU3eynyfTmDfeSu2diXm7NAOout4BlhoR28ZPUeEga
 4KghsWbfkxK1Ega6R3KVe/hXOvpSOWdHPqWx8d8ESJRoLQoZ4IQRnaHHVxpfv6YGWvoA8/rOrqTGA
 q/gei9hK2gJVkiQxWvvC0lfLHwuiMpn8f4YtYWqL1puv0UD1RShlt6NUbp7JVSbtwexEyIs3gmqnh
 iRFpN5s9tTQyyA==;
From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
In-Reply-To: <a2074b0b0bd1788f890f9ddb60cd697acc8b1d0a.1742453401.git.sarg@HIDDEN>
 (Sergey Trofimov's message of "Thu, 20 Mar 2025 07:50:18 +0100")
References: <cover.1741979546.git.sarg@HIDDEN>
 <a2074b0b0bd1788f890f9ddb60cd697acc8b1d0a.1742453401.git.sarg@HIDDEN>
Date: Thu, 17 Apr 2025 22:42:04 +0200
Message-ID: <87r01qzfj7.fsf_-_@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hi,

Sergey Trofimov <sarg@HIDDEN> writes:

> * gnu/machine/hetzner.scm (hetzner-configuration): Add ipv4 and ipv6
> fields. Export accessors.
> * gnu/machine/hetzner/http.scm (hetnzer-api-primary-ips): New function.
> (<hetzner-primary-ip>): New json mapping.
> (hetzner-api-server-create): Pass IP addresses in request.
> * doc/guix.texi: Document it.
                 ^
Please specify the name of the node that is modified, for this list
bullet:=20

  * doc/guix.texi (Invoking guix deploy): Document it.

> +@item @code{ipv4} (default: @code{'create})
> +When false, no public IPv4 address is going to be attached. Specify the
> +name of an existing primary ip to attach it to the machine. Other values
> +would create a new address automatically.
> +
> +@item @code{ipv6} (default: @code{'create})
> +When false, no public IPv6 address is going to be attached. Specify the
> +name of an existing primary ip to attach it to the machine. Other values
> +would create a new address automatically.

To avoid repetition, use @itemx like so:

  @item @code{ipv4} (default: @code{'create})
  @itemx @code{ipv6} (default: @code{'create})
  When false, no public IPv4 (respectively IPv6) address is attached. =E2=
=80=A6

Also, please leave to spaces after end-of-sentence periods and
capitalize acronyms like =E2=80=9CIP=E2=80=9D.

> +  (ipv4 hetzner-configuration-ipv4
> +        (default 'create))
> +  (ipv6 hetzner-configuration-ipv6
> +        (default 'create))

Am I right that 'create doesn=E2=80=99t have any special meaning?  In that =
case,
it seems to be that it should be either #f or a string?  Or #f or string
or #t?  This should be documented.

> +(define-json-mapping <hetzner-primary-ip>

Please add a short comment above explaining what this is, possibly
linking to the relevant Hetzner doc.

The rest LGTM at first sight but I know nothing about Hetzner so I=E2=80=99d
prefer if Roman could chime in.

Thanks!

Ludo=E2=80=99.




Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#77019] [PATCH 0/1] machine: hetzner: Allow attaching existing public IPs.
Resent-From: Roman Scherer <roman.scherer@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Fri, 18 Apr 2025 11:15:03 +0000
Resent-Message-ID: <handler.77019.B77019.174497485731132 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 77019
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Cc: Roman Scherer <roman@HIDDEN>, Sergey Trofimov <sarg@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>, 77019 <at> debbugs.gnu.org
Received: via spool by 77019-submit <at> debbugs.gnu.org id=B77019.174497485731132
          (code B ref 77019); Fri, 18 Apr 2025 11:15:03 +0000
Received: (at 77019) by debbugs.gnu.org; 18 Apr 2025 11:14:17 +0000
Received: from localhost ([127.0.0.1]:50132 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1u5jfk-00085z-SG
	for submit <at> debbugs.gnu.org; Fri, 18 Apr 2025 07:14:17 -0400
Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]:42427)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <roman.scherer@HIDDEN>)
 id 1u5jfg-00084Z-KB
 for 77019 <at> debbugs.gnu.org; Fri, 18 Apr 2025 07:14:14 -0400
Received: by mail-ej1-x62f.google.com with SMTP id
 a640c23a62f3a-acacb8743a7so300443266b.1
 for <77019 <at> debbugs.gnu.org>; Fri, 18 Apr 2025 04:14:12 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=burningswell-com.20230601.gappssmtp.com; s=20230601; t=1744974845;
 x=1745579645; darn=debbugs.gnu.org; 
 h=mime-version:message-id:date:user-agent:references:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=HZma5aZXVV1de/CwjMZ4LyU8vbNcCjX7x5423x/DxXI=;
 b=TXCSRsYqXH5v4y6NyQ4HqANgF33Utu63p/SgZ2Q5fRycIl4lTdfFQ7IBPCm6+FMglz
 bKbJQeI8Vr9/5Fhly+LgNhDKVMfMQ51jnmyp0uR6ZG5LFIQpnrAjA0W87V4+jqeVpmAJ
 +RPaoZydN+Z/JL5rG16LpeOo4lau4ZRsHOTVtvgMaBjtOZRENcSQ23Wr4TDigBtmPTa6
 w/nlP6M+RLvXfJUjcXWhiGSlsQmWhgpUA9yIlhLt6YH7KYY/5dcowGYmf4FR5tyJleV/
 CyXcSA/nm0woLTl3A6o+Kv3XS4GMli/B0V5OpSATMuqKiFCISPr4aTpUp7iTztU1KkeI
 9BIw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1744974845; x=1745579645;
 h=mime-version:message-id:date:user-agent:references:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=HZma5aZXVV1de/CwjMZ4LyU8vbNcCjX7x5423x/DxXI=;
 b=PCso0h/L3pXfXRHssHcGEw0+v09BsGPyJGviCfBiMxAKkJ3Q160jWRZLg4WNln9jif
 W9Dys7YFIgRSsm/0n7qVHMLfWunnwj6xNHbNUTTax9WQ7TUWA3rpCtgOR/D+lXIPnZlf
 MQMci+BGTFlS/PzK9Rw5rhGAl9/J29W4LejyNAMg8mWWo21ueCdnLtutNQZdjYY/jEdG
 PG06rpSirBFQjofP0m32nVxhjkdeG+Bj0+I2OAEL7WnJBeVNZ0isyxHLGjwkRC5vrA15
 Ciw4UXSydyXFoWcDX0spjgCV0Xo7VHPbJKk1uiK3sGcy7SaX0WOWoLJ1UN118scPhTGU
 PjJg==
X-Forwarded-Encrypted: i=1;
 AJvYcCVSy8btFEC3B2zQgRGAqD/T54cTbkZkaODnZliZmWaa3XUeh/4bbIjpAFQBh0VAudwzyC7hlg==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YxB0cmvx3f/mErOYUIdYd7GlY+ARu1M+4LLbzI6phOIIydPPDwp
 NimfPzG6EwBPNgzvsUGQfFtY93LVYyyAe3mj8XpimlSRB8L8uJ6AcBZGqpt3+lA=
X-Gm-Gg: ASbGncvtKVB05xcqc8CeSeOT2GuArZKsdf6XC28X4KW9RMIEcomx2+7w1pSMKfFUXtV
 9vnwfYdnAGMFW2gQBHA9+0ZtxJPGxtsqRqpbVBUvkGqf/4dRMjgpq4/UHSEnXtTtEEBbXUsk7Dh
 rAIHnyP4/thWdX0Vcpwlvw362ZfxBgFrZESaxGBzmLX3ArmE/PUWPSjnsGu4PSNAiWIsPnS9bxJ
 mg+SlETRnE70hLfd0T58UVAgazYG33/vZq5vNEiMAbY9FaEuzpHVUYWHfQRlVO9gJQisWJ4NDZd
 xboFaKcNooHU1DNxE+XywaBAd9x4XO7HWiKI0+MvhUGsyBYEolJz32jtum9c8ls2uw==
X-Google-Smtp-Source: AGHT+IEzeIcWCdLjILoEBZ6F8ffYUZjxjegQr6ZiSTw/XX0+TfLHxwohCCjtvaRC9J/2Zu3fJUs81Q==
X-Received: by 2002:a17:907:94c8:b0:acb:1165:9a93 with SMTP id
 a640c23a62f3a-acb6ec0f778mr289659166b.3.1744974845010; 
 Fri, 18 Apr 2025 04:14:05 -0700 (PDT)
Received: from precision ([2a01:598:ff0b:275d:7ff8:bd8f:785b:3027])
 by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-acb6eefcfa2sm107503566b.92.2025.04.18.04.14.03
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 18 Apr 2025 04:14:04 -0700 (PDT)
From: Roman Scherer <roman.scherer@HIDDEN>
In-Reply-To: <87r01qzfj7.fsf_-_@HIDDEN> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Thu, 17 Apr 2025 22:42:04 +0200")
References: <cover.1741979546.git.sarg@HIDDEN>
 <a2074b0b0bd1788f890f9ddb60cd697acc8b1d0a.1742453401.git.sarg@HIDDEN>
 <87r01qzfj7.fsf_-_@HIDDEN>
User-Agent: mu4e 1.12.9; emacs 29.4
Date: Fri, 18 Apr 2025 13:13:58 +0200
Message-ID: <87zfgd203t.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha256; protocol="application/pgp-signature"
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable


Hi Ludovic and Sergey,

the patch looks good to me. Thanks for adding the tests.

I would have expected #t, #f or a string as the value of
hetzner-configuration-ipv4 and hetzner-configuration-ipv6.

It's a pitty the null issue in guile-json has no comments yet.

I would say, let's merge it. The default behaviour right now is to
enable ipv4 and ipv6 and this patch does the same. Once the issue in
guile-json has been fixed we gain the ability to disable via #f, right?

Thanks, Roman.

Ludovic Court=C3=A8s <ludo@HIDDEN> writes:

> Hi,
>
> Sergey Trofimov <sarg@HIDDEN> writes:
>
>> * gnu/machine/hetzner.scm (hetzner-configuration): Add ipv4 and ipv6
>> fields. Export accessors.
>> * gnu/machine/hetzner/http.scm (hetnzer-api-primary-ips): New function.
>> (<hetzner-primary-ip>): New json mapping.
>> (hetzner-api-server-create): Pass IP addresses in request.
>> * doc/guix.texi: Document it.
>                  ^
> Please specify the name of the node that is modified, for this list
> bullet:
>
>   * doc/guix.texi (Invoking guix deploy): Document it.
>
>> +@item @code{ipv4} (default: @code{'create})
>> +When false, no public IPv4 address is going to be attached. Specify the
>> +name of an existing primary ip to attach it to the machine. Other values
>> +would create a new address automatically.
>> +
>> +@item @code{ipv6} (default: @code{'create})
>> +When false, no public IPv6 address is going to be attached. Specify the
>> +name of an existing primary ip to attach it to the machine. Other values
>> +would create a new address automatically.
>
> To avoid repetition, use @itemx like so:
>
>   @item @code{ipv4} (default: @code{'create})
>   @itemx @code{ipv6} (default: @code{'create})
>   When false, no public IPv4 (respectively IPv6) address is attached. =E2=
=80=A6
>
> Also, please leave to spaces after end-of-sentence periods and
> capitalize acronyms like =E2=80=9CIP=E2=80=9D.
>
>> +  (ipv4 hetzner-configuration-ipv4
>> +        (default 'create))
>> +  (ipv6 hetzner-configuration-ipv6
>> +        (default 'create))
>
> Am I right that 'create doesn=E2=80=99t have any special meaning?  In tha=
t case,
> it seems to be that it should be either #f or a string?  Or #f or string
> or #t?  This should be documented.
>
>> +(define-json-mapping <hetzner-primary-ip>
>
> Please add a short comment above explaining what this is, possibly
> linking to the relevant Hetzner doc.
>
> The rest LGTM at first sight but I know nothing about Hetzner so I=E2=80=
=99d
> prefer if Roman could chime in.
>
> Thanks!
>
> Ludo=E2=80=99.

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQFTBAEBCAA9FiEE0iajOdjfRIFd3gygPdpSUn0qwZkFAmgCM/YfHHJvbWFuLnNj
aGVyZXJAYnVybmluZ3N3ZWxsLmNvbQAKCRA92lJSfSrBmRrUB/0SIXjQQc0/FsaT
78PxeMwhpKsTR71xUiiiOmJFAHwIYx0XhM23fPYE58dJG2mnIFmfK7ONOomsTf0n
xZSAGzqHuoAo70NSc48wwzFyaXbIjTCOwsl9v4vYNTYrpipTONBH1m3K/Nx7GqkK
Gk8h8ZiRGVm/IBfjbp6KVKuPFUAx8688f7HzJcL33gIvo4GkqWyzVQyfB7dJ0/G1
e6DCLAhKwXC1NL48pXwBfDfY0/8uqUBsknHtDul1fOd4cV4YAST2S3+NX+inGa/V
TD5ZrrROJAE7vPyi3t8YykEMD5ksetB7DrDWUPEuvIR1NzR1F8/r7zv01SflU/dG
vX5YodNh
=ZJH2
-----END PGP SIGNATURE-----
--=-=-=--





Last modified: Fri, 18 Apr 2025 11:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.