From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-20.smtp.github.com (out-20.smtp.github.com [192.30.252.203]) by mail.toke.dk (Postfix) with ESMTPS id A7FB38C61E1 for ; Thu, 30 Sep 2021 09:15:48 +0200 (CEST) Authentication-Results: mail.toke.dk; dkim=pass (1024-bit key) header.d=github.com header.i=@github.com header.b=1F0ME+rr Received: from github-lowworker-3d542c1.va3-iad.github.net (github-lowworker-3d542c1.va3-iad.github.net [10.48.123.81]) by smtp.github.com (Postfix) with ESMTP id 65B3DE0F45 for ; Thu, 30 Sep 2021 00:15:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=github.com; s=pf2014; t=1632986147; bh=VcLRDXuO9l52/KyRQzfC8o4F68dfzN3RQRXSU/irPOc=; h=Date:From:Reply-To:To:Cc:In-Reply-To:References:Subject:List-ID: List-Archive:List-Post:List-Unsubscribe:From; b=1F0ME+rraO2MOdJfsh7cQBvzCtgwsKOPLzHG/8D3useyvCNVkYsA5lopkrbte6LuQ IqA/Y/kkq6Ho7gfO87nYTy9dcJuJvBtmmvfHwYgFTamp5tvKUBjCDQBWtcExA9buHb +z/RBqabRCUSxaY5LgnTgHwuM7/P49i/yBum/ALo= Date: Thu, 30 Sep 2021 00:15:47 -0700 From: Pete Heist To: tohojo/flent Message-ID: In-Reply-To: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="--==_mimepart_6155642357ac6_28c7c76014725b"; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: list X-GitHub-Sender: heistp X-GitHub-Recipient: flent-users X-GitHub-Reason: subscribed X-Auto-Response-Suppress: All X-GitHub-Recipient-Address: flent-users@flent.org Message-ID-Hash: 2Y43RLLWNMUBS22JIILX5IANQRC53L3M X-Message-ID-Hash: 2Y43RLLWNMUBS22JIILX5IANQRC53L3M X-MailFrom: noreply@github.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Subscribed X-Mailman-Version: 3.3.4 Reply-To: tohojo/flent Subject: [Flent-users] Re: [tohojo/flent] runners: Bracket IPv6 addresses before passing to irtt (#239) List-Id: Flent discussion list Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: ----==_mimepart_6155642357ac6_28c7c76014725b Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit @heistp commented on this pull request. > @@ -1682,7 +1683,13 @@ def check(self): if self.ip_version is not None: args.append("-{}".format(self.ip_version)) - args.append(self.host) + try: + ipaddress.IPv6Address(self.host) + host = "[{}]".format(self.host) + except ValueError: + host = self.host It just occurred to me that when adding optional parameters, it might be good practice to specify them by name in calls to those functions, so I updated that. I don't know what normal python practice is. I guess as long as the parameter positions don't change it's not critical, but this might also make it more apparent what you're doing in the call itself. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/tohojo/flent/pull/239#discussion_r719123312 ----==_mimepart_6155642357ac6_28c7c76014725b Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit

@heistp commented on this pull request.


In flent/runners.py:

> @@ -1682,7 +1683,13 @@ def check(self):
             if self.ip_version is not None:
                 args.append("-{}".format(self.ip_version))
 
-            args.append(self.host)
+            try:
+                ipaddress.IPv6Address(self.host)
+                host = "[{}]".format(self.host)
+            except ValueError:
+                host = self.host

It just occurred to me that when adding optional parameters, it might be good practice to specify them by name in calls to those functions, so I updated that. I don't know what normal python practice is. I guess as long as the parameter positions don't change it's not critical, but this might also make it more apparent what you're doing in the call itself.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.

----==_mimepart_6155642357ac6_28c7c76014725b--