brintos

brintos / linux-shallow public Read only

0
0
Text · 541 B · 7d5eeb0 Raw
22 lines · python
1# SPDX-License-Identifier: GPL-2.02 3import os4import subprocess5 6from lib.py import cmd7 8 9class Remote:10    def __init__(self, name, dir_path):11        self.name = name12        self.dir_path = dir_path13 14    def cmd(self, comm):15        return subprocess.Popen(["ip", "netns", "exec", self.name, "bash", "-c", comm],16                                 stdout=subprocess.PIPE, stderr=subprocess.PIPE)17 18    def deploy(self, what):19        if os.path.isabs(what):20            return what21        return os.path.abspath(self.dir_path + "/" + what)22