from ... import Configuration
from ...Machine.PaedMLMachineCollection import MACHINE_COLLECTION
from ..General.CheckForSshSession import CheckForSSHSession
from ..General.UcsRepositorySetup import UcsRepositorySetup
from ...SetupSteps.Playbooks.Playbook import Playbook


class SetupLmzRepo(Playbook):
    def start(self):
        if not self.is_sub_playbook:
            self.run_steps(CheckForSSHSession())

        self.run_steps(
            UcsRepositorySetup(MACHINE_COLLECTION.server, 'lmz', Configuration.get_val("repository", "server")),
            UcsRepositorySetup(MACHINE_COLLECTION.backup, 'lmz', Configuration.get_val("repository", "server"))
        )
