Commit 4567a575 authored by Mudassar Khan's avatar Mudassar Khan
Browse files

resolve heredoc break issue in pyinfra deployment script and resolve linting issue of meepctl

parent 094fdd81
Loading
Loading
Loading
Loading
+4 −3
Changes for deploy/pyinfra/lib/operations/kubernetes.py: 4 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -37,8 +37,9 @@ class ReachableDnsServers(FactBase):
        return []

    def command(self, servers):
        return (
            "python3 - " + " ".join(servers) + " <<'EOF'\n"
        # No heredoc: pyinfra wraps the command in "(...)" for requires_command,
        # which would put ")" on the terminator line and break the heredoc
        script = (
            "import socket, struct, sys\n"
            "query = struct.pack('>HHHHHH', 0x4d45, 0x0100, 1, 0, 0, 0)\n"
            "query += b''.join(bytes([len(p)]) + p.encode() for p in 'github.com'.split('.'))\n"
@@ -52,8 +53,8 @@ class ReachableDnsServers(FactBase):
            "            print(server)\n"
            "    except OSError:\n"
            "        pass\n"
            "EOF"
        )
        return "python3 -c " + shlex.quote(script) + " " + " ".join(shlex.quote(s) for s in servers)

    def process(self, output):
        return [line.strip() for line in output if line.strip()]
+1 −1

File changed.

Contains only whitespace changes.