Пример #1
0
 def destroyVm(self, n):
     vmPath = getPath() + 'root' + str(n)
     if os.path.isdir(vmPath):
         # Umount and remove
         for d in settings.js["mount_dirs"].keys():
             execute('sudo umount ' + vmPath + "/" + d)
         execute('sudo rm -R ' + vmPath)
Пример #2
0
 async def restartServer(self):
     """
     Updates with remote and restarts the server
     """
     execute("git fetch && git pull")
     await self.close()
     os.execv(executable, [executable, __file__])
     exit()
Пример #3
0
    def getLastCommitInfo(self):
        """
        Gets the last commit info
        """

        execute(
            'git log --pretty=format:"%h - %an, %ar : %s" | head -n 1 > .lastcommit'
        )
        execute('git log --pretty=format:"%H" >> .lastcommit')
        r = readFile(".lastcommit")
        os.remove(".lastcommit")
        return r.split("\n")
Пример #4
0
 def destroyAllScreens(self):
     execute("screen -ls | grep '" + settings.js["screen_prefix"] +
             "' | awk '{print $1}' | xargs -I % -t screen -X -S % quit")
Пример #5
0
 def createVm(self, n):
     vmPath = getPath() + 'root' + str(n)
     self.destroyVm(n)
     execute('mkdir ' + vmPath)
     for d in self.mount_dirs.keys():
         execute('mkdir ' + vmPath + "/" + d)
         execute("sudo mount --bind " + self.mount_dirs[d] + " " + vmPath +
                 "/" + d)
     for d in self.other_dirs:
         execute('mkdir ' + vmPath + "/" + d)
         execute('sudo chown ' + settings.js["chroot_username"] + ' ' +
                 vmPath + "/" + d)
         execute('sudo chmod ug=rwx ' + vmPath + "/" + d)
Пример #6
0
 def execute(self, code):
     box.execute(code)