def installOpenjre(openjreFile, progress):
    td = "/var/snap/subutai-dev/common/lxc/tmpdir/"
    awk = " | awk '{print $5}'"

    rc = subutai.SSHStartSession("mng-setup2")
    if rc != 0:
        subutai.AddStatus("Downloading JVM")
        subutai.SSHRun("sudo subutai -d import openjre16 1>/tmp/openjre16-1.log 2>/tmp/openjre16-2.log")
        return 0

    subutai.AddStatus("Downloading JVM")
    rc = subutai.SSHExecute("mng-setup2", "sudo subutai import openjre16 &")
    if rc[0] != 0:
        subutai.RaiseError("Failed to install OpenJRE in background. Switching to static install")
        subutai.SSHRun("sudo subutai import openjre16 >/tmp/openjre16.log 2>&1")
    else:
        checks = 0
        while True:
            out = subutai.SSHRunOut("ps -ef | grep \"subutai import\" | grep -v grep | awk '{print $2}'")
            if out == '':
                break
            sleep(1)
            checks = checks + 1
            if checks >= 60:
                subutai.SSHExecute("mng-setup2", "ls / &")
                checks = 0
            out = subutai.SSHRunOut("ls -l "+td+openjreFile+awk)
            try:
                val = int(out)
                progress.setOpenjreProgress(val)
                progress.updateProgress()
            except:
                pass

    subutai.SSHStopSession("mng-setup2")
Ejemplo n.º 2
0
    def InstallUbuntu(self):
        subutai.SetAction("INSTUB")
        td = "/var/snap/subutai/common/lxc/tmpdir/"
        awk = " | awk '{print $5}'"

        subutai.AddStatus("Downloading Ubuntu Linux")
        rc = subutai.SSHStartSession("mng-setup")

        if rc != 0:
            subutai.RaiseError(
                "Failed to install Ubuntu interactively. Switching to static install"
            )
            subutai.SSHRun(
                "sudo subutai -d import ubuntu16 >/tmp/ubuntu16.log 2>&1")
            return 0

        rc = subutai.SSHExecute("mng-setup", "sudo subutai import ubuntu16 &")
        if rc[0] != 0:
            subutai.RaiseError(
                "Failed to install Ubuntu in background. Switching to static install"
            )
            subutai.SSHRun(
                "sudo subutai -d import ubuntu16 >/tmp/ubuntu16.log 2>&1")
        else:
            checks = 0
            while True:
                out = subutai.SSHRunOut(
                    "ps -ef | grep \"subutai import\" | grep -v grep | awk '{print $2}'"
                )
                if out == '':
                    subutai.AddStatus("Download completed")
                    break
                sleep(1)
                checks = checks + 1
                if checks >= 60:
                    subutai.SSHExecute("mng-setup", "ls / &")
                    checks = 0
                out = subutai.SSHRunOut("ls -l " + td + self.UbuntuFile + awk)
                try:
                    val = int(out)
                    self.progress.setUbuntuProgress(val)
                    self.progress.updateProgress()
                except:
                    pass

        subutai.SSHStopSession("mng-setup")
        return 0
Ejemplo n.º 3
0
    def InstallManagement(self):
        subutai.SetAction("INSTMNG")
        td = "/var/snap/subutai/common/lxc/tmpdir/"
        awk = " | awk '{print $5}'"

        rc = subutai.SSHStartSession("mng-setup3")
        if rc != 0:
            subutai.AddStatus("Installing Management Container")
            subutai.SSHRun(
                "sudo subutai -d import management 1>/tmp/management-1.log 2>/tmp/management-2.log"
            )
            return 0

        subutai.AddStatus("Installing Management Container")
        rc = subutai.SSHExecute("mng-setup3",
                                "sudo subutai import management &")
        if rc[0] != 0:
            subutai.RaiseError(
                "Failed to install Management in background. Switching to static install"
            )
            subutai.SSHRun(
                "sudo subutai import management >/tmp/management.log 2>&1")
        else:
            checks = 0
            while True:
                out = subutai.SSHRunOut(
                    "ps -ef | grep \"subutai import\" | grep -v grep | awk '{print $2}'"
                )
                if out == '':
                    break
                sleep(1)
                checks = checks + 1
                if checks >= 60:
                    subutai.SSHExecute("mng-setup3", "ls / &")
                    checks = 0
                out = subutai.SSHRunOut("ls -l " + td + "*" +
                                        self.ManagementFile + "*" + awk)
                try:
                    val = int(out)
                    self.progress.setManagementProgress(val)
                    self.progress.updateProgress()
                except:
                    pass

        subutai.SSHStopSession("mng-setup3")
        return 0