mirror of
https://github.com/davegallant/davegallant.github.io.git
synced 2025-08-14 12:20:19 +00:00
deploy: 6b5bd7047f
This commit is contained in:
87
blog/2018/07/13/first-post/index.html
Normal file
87
blog/2018/07/13/first-post/index.html
Normal file
@@ -0,0 +1,87 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en-us">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
"@context" : "http://schema.org",
|
||||
"@type" : "BlogPosting",
|
||||
"mainEntityOfPage": {
|
||||
"@type": "WebPage",
|
||||
"@id": "/"
|
||||
},
|
||||
"articleSection" : "post",
|
||||
"name" : "First Post",
|
||||
"headline" : "First Post",
|
||||
"description" : "introduction",
|
||||
"inLanguage" : "en-US",
|
||||
"author" : "",
|
||||
"creator" : "",
|
||||
"publisher": "",
|
||||
"accountablePerson" : "",
|
||||
"copyrightHolder" : "",
|
||||
"copyrightYear" : "2018",
|
||||
"datePublished": "2018-07-13 08:52:45 -0400 EDT",
|
||||
"dateModified" : "2018-07-13 08:52:45 -0400 EDT",
|
||||
"url" : "/blog/2018/07/13/first-post/",
|
||||
"wordCount" : "40",
|
||||
"keywords" : [ "python","golang","javascript","Blog" ]
|
||||
}
|
||||
</script>
|
||||
<title>First Post</title>
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.2/css/bootstrap.min.css" integrity="sha384-Smlep5jCw/wG7hdkwQ/Z5nLIefveQRIY9nfy6xoR1uRYBtpZgI6339F5dgvm/e9B"
|
||||
crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="/css/style.css" />
|
||||
|
||||
<script>
|
||||
var doNotTrack = false;
|
||||
if (!doNotTrack) {
|
||||
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
|
||||
ga('create', 'UA-98710982-2', 'auto');
|
||||
|
||||
ga('send', 'pageview');
|
||||
}
|
||||
</script>
|
||||
<script async src='https://www.google-analytics.com/analytics.js'></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<nav>
|
||||
<ul class="menu">
|
||||
|
||||
<li><a class="btn btn-outline-dark" href="/">Home</a></li>
|
||||
|
||||
<li><a class="btn btn-outline-dark" href="/about/">About</a></li>
|
||||
|
||||
<li><a class="btn btn-outline-dark" href="/categories/">Categories</a></li>
|
||||
|
||||
<li><a class="btn btn-outline-dark" href="/tags/">Tags</a></li>
|
||||
|
||||
<li><a class="btn btn-outline-dark" href="/index.xml">Subscribe</a></li>
|
||||
|
||||
</ul>
|
||||
<hr/>
|
||||
</nav>
|
||||
|
||||
<div class="article-meta">
|
||||
<h1><span class="title">First Post</span></h1>
|
||||
<h2 class="author">Dave Gallant</h2>
|
||||
<h2 class="date">2018/07/13</h2>
|
||||
</div>
|
||||
|
||||
<main>
|
||||
<p>Hello. My plan is to pour useful code snippets, tips and tricks into these pages. I have a fond interest in programming (especially with Python, TypeScript and Golang). Hopefully something within these pages will help you out in your journey.</p>
|
||||
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
|
||||
|
||||
<hr/>
|
||||
© Dave Gallant 2018 | <a href="https://github.com/davegallant">Github</a> | <a href="https://twitter.com/__dave_g__">Twitter</a>
|
||||
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
160
blog/2018/07/18/why-learn-python/index.html
Normal file
160
blog/2018/07/18/why-learn-python/index.html
Normal file
@@ -0,0 +1,160 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en-us">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
"@context" : "http://schema.org",
|
||||
"@type" : "BlogPosting",
|
||||
"mainEntityOfPage": {
|
||||
"@type": "WebPage",
|
||||
"@id": "/"
|
||||
},
|
||||
"articleSection" : "post",
|
||||
"name" : "Why Learn Python?",
|
||||
"headline" : "Why Learn Python?",
|
||||
"description" : "<p>Python is a high-level, general-purpose language that has a wide range of use cases from the mundanely simple to the increasingly complex.</p>
|
||||
|
||||
<p></p>",
|
||||
"inLanguage" : "en-US",
|
||||
"author" : "",
|
||||
"creator" : "",
|
||||
"publisher": "",
|
||||
"accountablePerson" : "",
|
||||
"copyrightHolder" : "",
|
||||
"copyrightYear" : "2018",
|
||||
"datePublished": "2018-07-18 20:48:15 -0400 EDT",
|
||||
"dateModified" : "2018-07-18 20:48:15 -0400 EDT",
|
||||
"url" : "/blog/2018/07/18/why-learn-python/",
|
||||
"wordCount" : "295",
|
||||
"keywords" : [ "python","pip","Blog" ]
|
||||
}
|
||||
</script>
|
||||
<title>Why Learn Python?</title>
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.2/css/bootstrap.min.css" integrity="sha384-Smlep5jCw/wG7hdkwQ/Z5nLIefveQRIY9nfy6xoR1uRYBtpZgI6339F5dgvm/e9B"
|
||||
crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="/css/style.css" />
|
||||
|
||||
<script>
|
||||
var doNotTrack = false;
|
||||
if (!doNotTrack) {
|
||||
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
|
||||
ga('create', 'UA-98710982-2', 'auto');
|
||||
|
||||
ga('send', 'pageview');
|
||||
}
|
||||
</script>
|
||||
<script async src='https://www.google-analytics.com/analytics.js'></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<nav>
|
||||
<ul class="menu">
|
||||
|
||||
<li><a class="btn btn-outline-dark" href="/">Home</a></li>
|
||||
|
||||
<li><a class="btn btn-outline-dark" href="/about/">About</a></li>
|
||||
|
||||
<li><a class="btn btn-outline-dark" href="/categories/">Categories</a></li>
|
||||
|
||||
<li><a class="btn btn-outline-dark" href="/tags/">Tags</a></li>
|
||||
|
||||
<li><a class="btn btn-outline-dark" href="/index.xml">Subscribe</a></li>
|
||||
|
||||
</ul>
|
||||
<hr/>
|
||||
</nav>
|
||||
|
||||
<div class="article-meta">
|
||||
<h1><span class="title">Why Learn Python?</span></h1>
|
||||
<h2 class="author">Dave Gallant</h2>
|
||||
<h2 class="date">2018/07/18</h2>
|
||||
</div>
|
||||
|
||||
<main>
|
||||
<p>Python is a high-level, general-purpose language that has a wide range of use cases from the mundanely simple to the increasingly complex.</p>
|
||||
|
||||
<p></p>
|
||||
|
||||
<ul>
|
||||
<li>Glue script?</li>
|
||||
<li>Web crawling?</li>
|
||||
<li>Web server?</li>
|
||||
<li>Testing?</li>
|
||||
<li>Micro-service?</li>
|
||||
<li>Network automation?</li>
|
||||
<li>Data Science?</li>
|
||||
<li>Machine Learning?</li>
|
||||
</ul>
|
||||
|
||||
<p>Python is likely a quick way to get any of these tasks done.</p>
|
||||
|
||||
<p>Including the abundant number of packages that can be found on <a href="https://pypi.org/">Python Package Index</a>, there is likely a package that can help you.</p>
|
||||
|
||||
<p>Do you want to download a webpage?</p>
|
||||
|
||||
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">pip install requests</code></pre></div>
|
||||
|
||||
<p>and then invoke the <a href="https://docs.python.org/3/tutorial/interpreter.html">Python interpreter</a>:</p>
|
||||
|
||||
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-python" data-lang="python">Python <span style="color:#ae81ff">3.7</span><span style="color:#f92672">.</span><span style="color:#ae81ff">0</span> (default, Jun <span style="color:#ae81ff">29</span> <span style="color:#ae81ff">2018</span>, <span style="color:#ae81ff">21</span>:<span style="color:#ae81ff">56</span>:<span style="color:#ae81ff">58</span>)
|
||||
[GCC <span style="color:#ae81ff">7.3</span><span style="color:#f92672">.</span><span style="color:#ae81ff">0</span>] on linux
|
||||
Type <span style="color:#e6db74">"help"</span>, <span style="color:#e6db74">"copyright"</span>, <span style="color:#e6db74">"credits"</span> <span style="color:#f92672">or</span> <span style="color:#e6db74">"license"</span> <span style="color:#66d9ef">for</span> more information<span style="color:#f92672">.</span>
|
||||
<span style="color:#f92672">>>></span> <span style="color:#f92672">import</span> requests
|
||||
<span style="color:#f92672">>>></span> requests<span style="color:#f92672">.</span>get(<span style="color:#e6db74">'https://www.theregister.co.uk/'</span>)<span style="color:#f92672">.</span>text</code></pre></div>
|
||||
|
||||
<p>After that, there is any number of things that can be done with the results.</p>
|
||||
|
||||
<p>As you can probably note, the syntax is simple and clean, which makes returning to your code months later less of a jarring experience.</p>
|
||||
|
||||
<h2 id="popularity">Popularity</h2>
|
||||
|
||||
<p>According to <a href="https://insights.stackoverflow.com/survey/2018/">Stack Overflow Stats</a>, Python has surpassed C# and PHP in popularity and is the 3rd most loved language, after Rust and Kotlin. Interestingly, it is “the most wanted language” for the second year in a row.</p>
|
||||
|
||||
<h2 id="drawbacks">Drawbacks</h2>
|
||||
|
||||
<p>Is Python the magical solution to all the world’s problems? No.</p>
|
||||
|
||||
<p>Python is not very suitable for much of the following:</p>
|
||||
|
||||
<ul>
|
||||
<li>Static typing</li>
|
||||
<li>Performance-critical application (i.e. graphically-intense video game)</li>
|
||||
<li>Mobile app development</li>
|
||||
<li>Front-end web development</li>
|
||||
</ul>
|
||||
|
||||
<h2 id="conclusion">Conclusion</h2>
|
||||
|
||||
<p>So should you learn it? or stick with shell scripting?</p>
|
||||
|
||||
<p>Because of Python’s simple syntax, dynamic typing and abundant Package Index, it makes the language a great asset to have in your toolchain.</p>
|
||||
|
||||
<p>And it hasn’t hurt that giants like Google, Facebook and Microsoft have invested heavily in Python.</p>
|
||||
|
||||
<h2 id="resources">Resources</h2>
|
||||
|
||||
<p>This list includes some truly remarkable resources for improving your Python:</p>
|
||||
|
||||
<ul>
|
||||
<li><p><a href="https://www.realpython.com">https://www.realpython.com</a></p></li>
|
||||
|
||||
<li><p><a href="https://pythonbytes.fm/">https://pythonbytes.fm/</a> (podcast)</p></li>
|
||||
|
||||
<li><p><a href="https://talkpython.fm/">https://talkpython.fm/</a> (podcast)</p></li>
|
||||
|
||||
<li><p><a href="https://awesome-python.com/">https://awesome-python.com/</a></p></li>
|
||||
</ul>
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
|
||||
|
||||
<hr/>
|
||||
© Dave Gallant 2018 | <a href="https://github.com/davegallant">Github</a> | <a href="https://twitter.com/__dave_g__">Twitter</a>
|
||||
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
120
blog/2020/03/16/appgate-sdp-on-arch-linux/index.html
Normal file
120
blog/2020/03/16/appgate-sdp-on-arch-linux/index.html
Normal file
@@ -0,0 +1,120 @@
|
||||
<!doctype html><html lang=en-us>
|
||||
<head>
|
||||
<meta charset=utf-8>
|
||||
<meta name=viewport content="width=device-width,initial-scale=1">
|
||||
<script type=application/ld+json>{"@context":"http://schema.org","@type":"BlogPosting","mainEntityOfPage":{"@type":"WebPage","@id":"\/"},"articleSection":"post","name":"AppGate SDP on Arch Linux","headline":"AppGate SDP on Arch Linux","description":"\u003cp\u003eAppGate SDP provides a Zero Trust network. This post describes how to get AppGate SDP \u003ccode\u003e4.3.2\u003c\/code\u003e working on Arch Linux.\u003c\/p\u003e","inLanguage":"en-US","author":"","creator":"","publisher":"","accountablePerson":"","copyrightHolder":"","copyrightYear":"2020","datePublished":"2020-03-16 22:00:15 -0400 -0400","dateModified":"2020-03-16 22:00:15 -0400 -0400","url":"\/blog\/2020\/03\/16\/appgate-sdp-on-arch-linux\/","wordCount":"506","keywords":["linux","vpn","python","Blog"]}</script>
|
||||
<title>AppGate SDP on Arch Linux</title>
|
||||
<link rel=stylesheet href=https://stackpath.bootstrapcdn.com/bootstrap/4.1.2/css/bootstrap.min.css integrity=sha384-Smlep5jCw/wG7hdkwQ/Z5nLIefveQRIY9nfy6xoR1uRYBtpZgI6339F5dgvm/e9B crossorigin=anonymous>
|
||||
<link rel=stylesheet href=/css/style.css>
|
||||
<script type=application/javascript>var doNotTrack=!1;doNotTrack||(window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)},ga.l=+new Date,ga('create','UA-98710982-2','auto'),ga('send','pageview'))</script>
|
||||
<script async src=https://www.google-analytics.com/analytics.js></script>
|
||||
</head>
|
||||
<body>
|
||||
<nav>
|
||||
<ul class=menu>
|
||||
<li><a class="btn btn-outline-dark" href=/>Home</a></li>
|
||||
<li><a class="btn btn-outline-dark" href=/about/>About</a></li>
|
||||
<li><a class="btn btn-outline-dark" href=/categories/>Categories</a></li>
|
||||
<li><a class="btn btn-outline-dark" href=/tags/>Tags</a></li>
|
||||
<li><a class="btn btn-outline-dark" href=/index.xml>Subscribe</a></li>
|
||||
</ul>
|
||||
<hr>
|
||||
</nav>
|
||||
<div class=article-meta>
|
||||
<h1><span class=title>AppGate SDP on Arch Linux</span></h1>
|
||||
<h2 class=author>Dave Gallant
|
||||
2020/03/16</h2>
|
||||
</div>
|
||||
<main>
|
||||
<p>AppGate SDP provides a Zero Trust network. This post describes how to get AppGate SDP <code>4.3.2</code> working on Arch Linux.</p>
|
||||
<p>Depending on the AppGate SDP Server that is running, you may require a client that is more recent than the latest package on <a href=https://aur.archlinux.org/packages/appgate-sdp/>AUR</a>.
|
||||
As of right now, the latest AUR is <code>4.2.2-1</code>.</p>
|
||||
<p>These steps highlight how to get it working with <code>Python3.8</code> by making a 1 line modification to AppGate source code.</p>
|
||||
<h1 id=package>Package</h1>
|
||||
<p>We already know the community package is out of date, so let’s clone it:</p>
|
||||
<div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell>git clone https://aur.archlinux.org/appgate-sdp.git
|
||||
cd appgate-sdp
|
||||
</code></pre></div><p>You’ll likely notice that the version is not what we want, so let’s modify the <code>PKGBUILD</code> to the following:</p>
|
||||
<div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell><span style=color:#75715e># Maintainer: Pawel Mosakowski <pawel at mosakowski dot net></span>
|
||||
pkgname<span style=color:#f92672>=</span>appgate-sdp
|
||||
conflicts<span style=color:#f92672>=(</span><span style=color:#e6db74>'appgate-sdp-headless'</span><span style=color:#f92672>)</span>
|
||||
pkgver<span style=color:#f92672>=</span>4.3.2
|
||||
_download_pkgver<span style=color:#f92672>=</span>4.3
|
||||
pkgrel<span style=color:#f92672>=</span><span style=color:#ae81ff>1</span>
|
||||
epoch<span style=color:#f92672>=</span>
|
||||
pkgdesc<span style=color:#f92672>=</span><span style=color:#e6db74>"Software Defined Perimeter - GUI client"</span>
|
||||
arch<span style=color:#f92672>=(</span><span style=color:#e6db74>'x86_64'</span><span style=color:#f92672>)</span>
|
||||
url<span style=color:#f92672>=</span><span style=color:#e6db74>"https://www.cyxtera.com/essential-defense/appgate-sdp/support"</span>
|
||||
license<span style=color:#f92672>=(</span><span style=color:#e6db74>'custom'</span><span style=color:#f92672>)</span>
|
||||
<span style=color:#75715e># dependecies calculated by namcap</span>
|
||||
depends<span style=color:#f92672>=(</span><span style=color:#e6db74>'gconf'</span> <span style=color:#e6db74>'libsecret'</span> <span style=color:#e6db74>'gtk3'</span> <span style=color:#e6db74>'python'</span> <span style=color:#e6db74>'nss'</span> <span style=color:#e6db74>'libxss'</span> <span style=color:#e6db74>'nodejs'</span> <span style=color:#e6db74>'dnsmasq'</span><span style=color:#f92672>)</span>
|
||||
source<span style=color:#f92672>=(</span><span style=color:#e6db74>"https://sdpdownloads.cyxtera.com/AppGate-SDP-</span><span style=color:#e6db74>${</span>_download_pkgver<span style=color:#e6db74>}</span><span style=color:#e6db74>/clients/</span><span style=color:#e6db74>${</span>pkgname<span style=color:#e6db74>}</span><span style=color:#e6db74>_</span><span style=color:#e6db74>${</span>pkgver<span style=color:#e6db74>}</span><span style=color:#e6db74>_amd64.deb"</span>
|
||||
<span style=color:#e6db74>"appgatedriver.service"</span><span style=color:#f92672>)</span>
|
||||
options<span style=color:#f92672>=(</span>staticlibs<span style=color:#f92672>)</span>
|
||||
prepare<span style=color:#f92672>()</span> <span style=color:#f92672>{</span>
|
||||
tar -xf data.tar.xz
|
||||
<span style=color:#f92672>}</span>
|
||||
package<span style=color:#f92672>()</span> <span style=color:#f92672>{</span>
|
||||
cp -dpr <span style=color:#e6db74>"</span><span style=color:#e6db74>${</span>srcdir<span style=color:#e6db74>}</span><span style=color:#e6db74>"</span>/<span style=color:#f92672>{</span>etc,lib,opt,usr<span style=color:#f92672>}</span> <span style=color:#e6db74>"</span><span style=color:#e6db74>${</span>pkgdir<span style=color:#e6db74>}</span><span style=color:#e6db74>"</span>
|
||||
mv -v <span style=color:#e6db74>"</span>$pkgdir<span style=color:#e6db74>/lib/systemd/system"</span> <span style=color:#e6db74>"</span>$pkgdir<span style=color:#e6db74>/usr/lib/systemd/"</span>
|
||||
rm -vrf <span style=color:#e6db74>"</span>$pkgdir<span style=color:#e6db74>/lib"</span>
|
||||
cp -v <span style=color:#e6db74>"</span>$srcdir<span style=color:#e6db74>/appgatedriver.service"</span> <span style=color:#e6db74>"</span>$pkgdir<span style=color:#e6db74>/usr/lib/systemd/system/appgatedriver.service"</span>
|
||||
mkdir -vp <span style=color:#e6db74>"</span>$pkgdir<span style=color:#e6db74>/usr/share/licenses/appgate-sdp"</span>
|
||||
cp -v <span style=color:#e6db74>"</span>$pkgdir<span style=color:#e6db74>/usr/share/doc/appgate/copyright"</span> <span style=color:#e6db74>"</span>$pkgdir<span style=color:#e6db74>/usr/share/licenses/appgate-sdp"</span>
|
||||
cp -v <span style=color:#e6db74>"</span>$pkgdir<span style=color:#e6db74>/usr/share/doc/appgate/LICENSE.github"</span> <span style=color:#e6db74>"</span>$pkgdir<span style=color:#e6db74>/usr/share/licenses/appgate-sdp"</span>
|
||||
cp -v <span style=color:#e6db74>"</span>$pkgdir<span style=color:#e6db74>/usr/share/doc/appgate/LICENSES.chromium.html.bz2"</span> <span style=color:#e6db74>"</span>$pkgdir<span style=color:#e6db74>/usr/share/licenses/appgate-sdp"</span>
|
||||
<span style=color:#f92672>}</span>
|
||||
md5sums<span style=color:#f92672>=(</span><span style=color:#e6db74>'17101aac7623c06d5fbb95f50cf3dbdc'</span>
|
||||
<span style=color:#e6db74>'002644116e20b2d79fdb36b7677ab4cf'</span><span style=color:#f92672>)</span>
|
||||
|
||||
</code></pre></div><p>Let’s first make sure we have some dependencies. If you do not have <a href=https://github.com/Jguer/yay>yay</a>, check it out.</p>
|
||||
<div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell>yay -S dnsmasq gconf
|
||||
</code></pre></div><p>Now, let’s install it:</p>
|
||||
<div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell>makepkg -si
|
||||
</code></pre></div><h1 id=run>Run</h1>
|
||||
<p>Ok, let’s run the client by executing <code>appgate</code>.</p>
|
||||
<p>It complains about not being able to connect.</p>
|
||||
<p>Easy fix:</p>
|
||||
<div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell>sudo systemctl start appgatedriver.service
|
||||
</code></pre></div><p>Now we should be connected… but DNS is not working?</p>
|
||||
<h1 id=fix-dns>Fix DNS</h1>
|
||||
<p>Running <code>resolvectl</code> should display that something is not right.</p>
|
||||
<p>Why is the DNS not being set by appgate?</p>
|
||||
<div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell>$ head -3 /opt/appgate/linux/set_dns
|
||||
<span style=color:#75715e>#!/usr/bin/env python3</span>
|
||||
<span style=color:#e6db74>''</span><span style=color:#960050;background-color:#1e0010>'</span>
|
||||
This is used to set and unset the DNS.
|
||||
</code></pre></div><p>It seems like python3 is required for the DNS setting to happen.
|
||||
Let’s try to run it.</p>
|
||||
<div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell>$ sudo /opt/appgate/linux/set_dns
|
||||
/opt/appgate/linux/set_dns:88: SyntaxWarning: <span style=color:#e6db74>"is"</span> with a literal. Did you mean <span style=color:#e6db74>"=="</span>?
|
||||
servers <span style=color:#f92672>=</span> <span style=color:#f92672>[(</span> socket.AF_INET <span style=color:#66d9ef>if</span> x.version is <span style=color:#ae81ff>4</span> <span style=color:#66d9ef>else</span> socket.AF_INET6, map<span style=color:#f92672>(</span>int, x.packed<span style=color:#f92672>))</span> <span style=color:#66d9ef>for</span> x in servers<span style=color:#f92672>]</span>
|
||||
Traceback <span style=color:#f92672>(</span>most recent call last<span style=color:#f92672>)</span>:
|
||||
File <span style=color:#e6db74>"/opt/appgate/linux/set_dns"</span>, line 30, in <module>
|
||||
import dbus
|
||||
ModuleNotFoundError: No module named <span style=color:#e6db74>'dbus'</span>
|
||||
</code></pre></div><p>Ok, let’s install it:</p>
|
||||
<div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell>$ sudo python3.8 -m pip install dbus-python
|
||||
</code></pre></div><p>It should work now… right?</p>
|
||||
<div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell>$ sudo /opt/appgate/linux/set_dns
|
||||
/opt/appgate/linux/set_dns:88: SyntaxWarning: <span style=color:#e6db74>"is"</span> with a literal. Did you mean <span style=color:#e6db74>"=="</span>?
|
||||
servers <span style=color:#f92672>=</span> <span style=color:#f92672>[(</span> socket.AF_INET <span style=color:#66d9ef>if</span> x.version is <span style=color:#ae81ff>4</span> <span style=color:#66d9ef>else</span> socket.AF_INET6, map<span style=color:#f92672>(</span>int, x.packed<span style=color:#f92672>))</span> <span style=color:#66d9ef>for</span> x in servers<span style=color:#f92672>]</span>
|
||||
module <span style=color:#e6db74>'platform'</span> has no attribute <span style=color:#e6db74>'linux_distribution'</span>
|
||||
</code></pre></div><p>This is a breaking change in Python3.8.</p>
|
||||
<p>So what is calling <code>platform.linux_distribution</code>?</p>
|
||||
<p>Let’s search for it:</p>
|
||||
<div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell>$ sudo grep -r <span style=color:#e6db74>'linux_distribution'</span> /opt/appgate/linux/
|
||||
/opt/appgate/linux/nm.py: <span style=color:#66d9ef>if</span> platform.linux_distribution<span style=color:#f92672>()[</span>0<span style=color:#f92672>]</span> !<span style=color:#f92672>=</span> <span style=color:#e6db74>'Fedora'</span>:
|
||||
</code></pre></div><p>Aha! So this is in the local AppGate source code. This should be an easy fix. Let’s just replace this line with:</p>
|
||||
<div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-python data-lang=python><span style=color:#66d9ef>if</span> <span style=color:#66d9ef>True</span>: <span style=color:#75715e># Since we are not using Fedora :)</span>
|
||||
</code></pre></div><h1 id=conclusion>Conclusion</h1>
|
||||
<p>It turns out there are <a href=https://docs.python.org/3.7/library/platform.html#platform.linux_distribution>breaking changes</a> in Python3.8.</p>
|
||||
<p>The docs that say <code>Deprecated since version 3.5, will be removed in version 3.8: See alternative like the distro package.</code></p>
|
||||
<p>I guess this highlights one of the caveats of relying upon system python.</p>
|
||||
</main>
|
||||
<footer>
|
||||
<hr>
|
||||
© Dave Gallant 2021 | <a href=https://github.com/davegallant>Github</a> | <a href=https://twitter.com/Dave_Gallant_>Twitter</a>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user