Change-Id: I99bc40797e505fed477e477c43ffb8cab8d1c625
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/2198
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Divya Thaluru <dthaluru@vmware.com>
| ... | ... |
@@ -18,15 +18,8 @@ |
| 18 | 18 |
"visible" : true, |
| 19 | 19 |
"include" : ["minimal"] |
| 20 | 20 |
}, |
| 21 |
- "ostree_host" : {
|
|
| 22 |
- "title" : "3. Photon OSTree Host", |
|
| 23 |
- "file" : "packages_ostree_host.json", |
|
| 24 |
- "visible" : true, |
|
| 25 |
- "include" : [], |
|
| 26 |
- "additional-files" : ["ostree-repo.tar.gz"] |
|
| 27 |
- }, |
|
| 28 | 21 |
"ostree_server" : {
|
| 29 |
- "title" : "4. Photon OSTree Server", |
|
| 22 |
+ "title" : "3. Photon OSTree Server", |
|
| 30 | 23 |
"file" : "packages_ostree_server.json", |
| 31 | 24 |
"visible" : true, |
| 32 | 25 |
"include" : ["minimal"], |
| ... | ... |
@@ -5,5 +5,5 @@ |
| 5 | 5 |
"libffi","expat","linux","cpio","Linux-PAM","attr","libcap", "systemd","dbus", |
| 6 | 6 |
"gzip", "sqlite-autoconf","nspr","nss","popt","lua","rpm","gptfdisk","tar", "librepo", |
| 7 | 7 |
"hawkey", "python2","python2-libs","pcre","glib", "tdnf", "python-requests", |
| 8 |
- "grub2", "grub2-efi", "efibootmgr", "efivar","dracut", "curl", "ostree", "dosfstools"] |
|
| 8 |
+ "grub2", "grub2-efi", "efibootmgr", "efivar","dracut", "curl", "dosfstools"] |
|
| 9 | 9 |
} |
| ... | ... |
@@ -5,7 +5,6 @@ |
| 5 | 5 |
# Author: Touseef Liaqat <tliaqat@vmware.com> |
| 6 | 6 |
|
| 7 | 7 |
from installer import Installer |
| 8 |
-from ostreeinstaller import OstreeInstaller |
|
| 9 | 8 |
from ostreeserverinstaller import OstreeServerInstaller |
| 10 | 9 |
|
| 11 | 10 |
class InstallerContainer(object): |
| ... | ... |
@@ -20,9 +19,7 @@ class InstallerContainer(object): |
| 20 | 20 |
|
| 21 | 21 |
def install(self, params): |
| 22 | 22 |
installer = None |
| 23 |
- if self.install_config['type'] == "ostree_host": |
|
| 24 |
- installer = OstreeInstaller(self.install_config, self.maxy, self.maxx, self.iso_installer, self.rpm_path, self.log_path, self.ks_config) |
|
| 25 |
- elif self.install_config['type'] == "ostree_server": |
|
| 23 |
+ if self.install_config['type'] == "ostree_server": |
|
| 26 | 24 |
installer = OstreeServerInstaller(self.install_config, self.maxy, self.maxx, self.iso_installer, self.rpm_path, self.log_path, self.ks_config) |
| 27 | 25 |
else: |
| 28 | 26 |
installer = Installer(self.install_config, self.maxy, self.maxx, self.iso_installer, self.rpm_path, self.log_path, self.ks_config) |
| ... | ... |
@@ -27,13 +27,10 @@ from packageselector import PackageSelector |
| 27 | 27 |
from custompackageselector import CustomPackageSelector |
| 28 | 28 |
from installer import Installer |
| 29 | 29 |
from installercontainer import InstallerContainer |
| 30 |
-from ostreeinstaller import OstreeInstaller |
|
| 31 | 30 |
from windowstringreader import WindowStringReader |
| 32 |
-from ostreewindowstringreader import OSTreeWindowStringReader |
|
| 33 | 31 |
from jsonwrapper import JsonWrapper |
| 34 | 32 |
from selectdisk import SelectDisk |
| 35 | 33 |
from license import License |
| 36 |
-from ostreeserverselector import OSTreeServerSelector |
|
| 37 | 34 |
from linuxselector import LinuxSelector |
| 38 | 35 |
|
| 39 | 36 |
class IsoInstaller(object): |
| ... | ... |
@@ -106,53 +103,6 @@ class IsoInstaller(object): |
| 106 | 106 |
machinename = fields[0] |
| 107 | 107 |
return (len(machinename) <= 64) and (ord(machinename[0]) in self.alpha_chars), error_hostname |
| 108 | 108 |
|
| 109 |
- def validate_ostree_url_input(self, ostree_repo_url): |
|
| 110 |
- if not ostree_repo_url: |
|
| 111 |
- return False, "Error: Invalid input" |
|
| 112 |
- |
|
| 113 |
- exception_text = "Error: Invalid or unreachable URL" |
|
| 114 |
- error_text = "Error: Repo URL not accessible" |
|
| 115 |
- ret = self.validate_http_response(ostree_repo_url, [], exception_text, error_text) |
|
| 116 |
- if ret != "": |
|
| 117 |
- return False, ret |
|
| 118 |
- |
|
| 119 |
- exception_text = "Error: Invalid repo - missing config" |
|
| 120 |
- ret = self.validate_http_response( |
|
| 121 |
- ostree_repo_url + "/config", |
|
| 122 |
- [ [".*\[core\]\s*", 1, "Error: Invalid config - 'core' group expected" ], |
|
| 123 |
- ["\s*mode[ \t]*=[ \t]*archive-z2[^ \t]", 1, "Error: can't pull from repo in 'bare' mode, 'archive-z2' mode required" ] ], |
|
| 124 |
- exception_text, exception_text) |
|
| 125 |
- if ret != "": |
|
| 126 |
- return False, ret |
|
| 127 |
- |
|
| 128 |
- exception_text = "Error: Invalid repo - missing refs" |
|
| 129 |
- ret = self.validate_http_response(ostree_repo_url + "/refs/heads", [], exception_text, exception_text) |
|
| 130 |
- if ret != "": |
|
| 131 |
- return False, ret |
|
| 132 |
- |
|
| 133 |
- exception_text = "Error: Invalid repo - missing objects" |
|
| 134 |
- ret = self.validate_http_response(ostree_repo_url + "/objects", [], exception_text, exception_text) |
|
| 135 |
- if ret != "": |
|
| 136 |
- return False, ret |
|
| 137 |
- |
|
| 138 |
- self.ostree_repo_url = ostree_repo_url |
|
| 139 |
- |
|
| 140 |
- return True, None |
|
| 141 |
- |
|
| 142 |
- def validate_ostree_refs_input(self, ostree_repo_ref): |
|
| 143 |
- if not ostree_repo_ref: |
|
| 144 |
- return False, "Error: Invalid input" |
|
| 145 |
- |
|
| 146 |
- ret = self.validate_http_response( |
|
| 147 |
- self.ostree_repo_url + '/refs/heads/' + ostree_repo_ref, |
|
| 148 |
- [ ["^\s*[0-9A-Fa-f]{64}\s*$", 1, "Error: Incomplete Refspec path, or unexpected Refspec format"] ],
|
|
| 149 |
- "Error: Invalid Refspec path", |
|
| 150 |
- "Error: Refspec not accessible") |
|
| 151 |
- if ret != "": |
|
| 152 |
- return False, ret |
|
| 153 |
- |
|
| 154 |
- return True, None |
|
| 155 |
- |
|
| 156 | 109 |
def validate_password(self, text): |
| 157 | 110 |
try: |
| 158 | 111 |
p = cracklib.VeryFascistCheck(text) |
| ... | ... |
@@ -279,29 +229,8 @@ class IsoInstaller(object): |
| 279 | 279 |
None, # validation function of the input |
| 280 | 280 |
self.generate_password_hash, # post processing of the input field |
| 281 | 281 |
'Confirm root password', 'Confirm Root password:', 2, install_config) |
| 282 |
- ostree_server_selector = OSTreeServerSelector(self.maxy, self.maxx, install_config) |
|
| 283 |
- ostree_url_reader = OSTreeWindowStringReader( |
|
| 284 |
- self.maxy, self.maxx, 10, 80, |
|
| 285 |
- 'ostree_repo_url', |
|
| 286 |
- None, # confirmation error msg if it's a confirmation text |
|
| 287 |
- None, # echo char |
|
| 288 |
- None, # set of accepted chars |
|
| 289 |
- self.validate_ostree_url_input, # validation function of the input |
|
| 290 |
- None, # post processing of the input field |
|
| 291 |
- 'Please provide the URL of OSTree repo', 'OSTree Repo URL:', 2, install_config, |
|
| 292 |
- "http://") |
|
| 293 |
- ostree_ref_reader = OSTreeWindowStringReader( |
|
| 294 |
- self.maxy, self.maxx, 10, 70, |
|
| 295 |
- 'ostree_repo_ref', |
|
| 296 |
- None, # confirmation error msg if it's a confirmation text |
|
| 297 |
- None, # echo char |
|
| 298 |
- None, # set of accepted chars |
|
| 299 |
- self.validate_ostree_refs_input, # validation function of the input |
|
| 300 |
- None, # post processing of the input field |
|
| 301 |
- 'Please provide the Refspec in OSTree repo', 'OSTree Repo Refspec:', 2, install_config, |
|
| 302 |
- "photon/1.0/x86_64/minimal") |
|
| 303 | 282 |
|
| 304 |
- items.append((license_agreement.display, False)) , |
|
| 283 |
+ items.append((license_agreement.display, False)) |
|
| 305 | 284 |
items.append((select_disk.display, True)) |
| 306 | 285 |
items.append((select_partition.display, False)) |
| 307 | 286 |
items.append((select_disk.guided_partitions, False)) |
| ... | ... |
@@ -314,9 +243,6 @@ class IsoInstaller(object): |
| 314 | 314 |
items.append((hostname_reader.get_user_string, True)) |
| 315 | 315 |
items.append((root_password_reader.get_user_string, True)) |
| 316 | 316 |
items.append((confirm_password_reader.get_user_string, False)) |
| 317 |
- items.append((ostree_server_selector.display, True)) |
|
| 318 |
- items.append((ostree_url_reader.get_user_string, True)) |
|
| 319 |
- items.append((ostree_ref_reader.get_user_string, True)) |
|
| 320 | 317 |
|
| 321 | 318 |
else: |
| 322 | 319 |
install_config = ks_config |
| ... | ... |
@@ -339,8 +265,7 @@ class IsoInstaller(object): |
| 339 | 339 |
break |
| 340 | 340 |
#Skip linux select screen for ostree installation. |
| 341 | 341 |
if index == select_linux_index: |
| 342 |
- if (install_config['type'] == 'ostree_host' or |
|
| 343 |
- install_config['type'] == 'ostree_server'): |
|
| 342 |
+ if (install_config['type'] == 'ostree_server'): |
|
| 344 | 343 |
index += 1 |
| 345 | 344 |
else: |
| 346 | 345 |
index -= 1 |
| ... | ... |
@@ -350,8 +275,7 @@ class IsoInstaller(object): |
| 350 | 350 |
index = 0 |
| 351 | 351 |
#Skip linux select screen for ostree installation. |
| 352 | 352 |
if index == select_linux_index: |
| 353 |
- if (install_config['type'] == 'ostree_host' or |
|
| 354 |
- install_config['type'] == 'ostree_server'): |
|
| 353 |
+ if (install_config['type'] == 'ostree_server'): |
|
| 355 | 354 |
index -= 1 |
| 356 | 355 |
|
| 357 | 356 |
if __name__ == '__main__': |
| 358 | 357 |
deleted file mode 100755 |
| ... | ... |
@@ -1,171 +0,0 @@ |
| 1 |
-#!/usr/bin/python2 |
|
| 2 |
-# |
|
| 3 |
-# Copyright (C) 2015 vmware inc. |
|
| 4 |
-# |
|
| 5 |
-# Author: Touseef Liaqat <tliaqat@vmware.com> |
|
| 6 |
- |
|
| 7 |
-import os |
|
| 8 |
-import glob |
|
| 9 |
-import modules.commons |
|
| 10 |
-from installer import Installer |
|
| 11 |
-from actionresult import ActionResult |
|
| 12 |
- |
|
| 13 |
-class OstreeInstaller(Installer): |
|
| 14 |
- |
|
| 15 |
- def __init__(self, install_config, maxy = 0, maxx = 0, iso_installer = False, rpm_path = "../stage/RPMS", log_path = "../stage/LOGS", ks_config = None): |
|
| 16 |
- Installer.__init__(self, install_config, maxy, maxx, iso_installer, rpm_path, log_path, ks_config) |
|
| 17 |
- self.repo_config = {}
|
|
| 18 |
- self.repo_read_conf() |
|
| 19 |
- |
|
| 20 |
- def get_ostree_repo_url(self): |
|
| 21 |
- self.default_repo = 'default_repo' in self.install_config and self.install_config['default_repo']; |
|
| 22 |
- if not self.default_repo: |
|
| 23 |
- self.ostree_repo_url = self.install_config['ostree_repo_url'] |
|
| 24 |
- self.ostree_ref = self.install_config['ostree_repo_ref'] |
|
| 25 |
- |
|
| 26 |
- def repo_read_conf(self): |
|
| 27 |
- with open("ostree-release-repo.conf") as repo_conf:
|
|
| 28 |
- for line in repo_conf: |
|
| 29 |
- name, value = line.partition("=")[::2]
|
|
| 30 |
- self.repo_config[name] = value.strip(' \n\t\r')
|
|
| 31 |
- |
|
| 32 |
- def pull_repo(self, repo_url, repo_ref): |
|
| 33 |
- if self.default_repo: |
|
| 34 |
- self.run("ostree remote add --repo={}/ostree/repo --set=gpg-verify=false photon {}".format(self.photon_root, repo_url), "Adding OSTree remote")
|
|
| 35 |
- self.run("ostree pull-local --repo={}/ostree/repo {}".format(self.photon_root, self.local_repo_path), "Pulling OSTree repo")
|
|
| 36 |
- self.run("mv {}/ostree/repo/refs/heads {}/ostree/repo/refs/remotes/photon".format(self.photon_root, self.photon_root))
|
|
| 37 |
- self.run("mkdir -p {}/ostree/repo/refs/heads".format(self.photon_root, self.photon_root))
|
|
| 38 |
- else: |
|
| 39 |
- self.run("ostree remote add --repo={}/ostree/repo --set=gpg-verify=false photon {}".format(self.photon_root, repo_url), "Adding OSTree remote")
|
|
| 40 |
- self.run("ostree pull --repo={}/ostree/repo photon {}".format(self.photon_root, repo_ref), "Pulling OSTree remote repo")
|
|
| 41 |
- |
|
| 42 |
- def deploy_ostree(self, repo_url, repo_ref): |
|
| 43 |
- self.run("ostree admin --sysroot={} init-fs {}".format(self.photon_root, self.photon_root), "Initializing OSTree filesystem")
|
|
| 44 |
- self.pull_repo(repo_url, repo_ref) |
|
| 45 |
- self.run("ostree admin --sysroot={} os-init photon ".format(self.photon_root), "OSTree OS Initializing")
|
|
| 46 |
- self.run("ostree admin --sysroot={} deploy --os=photon photon:{}".format(self.photon_root, repo_ref), "Deploying")
|
|
| 47 |
- |
|
| 48 |
- def do_systemd_tmpfiles_commands(self, commit_number): |
|
| 49 |
- prefixes = ["/var/home", |
|
| 50 |
- "/var/roothome", |
|
| 51 |
- "/var/lib/rpm", |
|
| 52 |
- "/var/opt", |
|
| 53 |
- "/var/srv", |
|
| 54 |
- "/var/userlocal", |
|
| 55 |
- "/var/mnt", |
|
| 56 |
- "/var/spool/mail"] |
|
| 57 |
- |
|
| 58 |
- for prefix in prefixes: |
|
| 59 |
- command = "systemd-tmpfiles --create --boot --root={}/ostree/deploy/photon/deploy/{}.0 --prefix={}".format(self.photon_root, commit_number, prefix)
|
|
| 60 |
- self.run(command) |
|
| 61 |
- |
|
| 62 |
- def mount_devices_in_deployment(self, commit_number): |
|
| 63 |
- for command in ["mount -t bind -o bind,defaults /dev {}/ostree/deploy/photon/deploy/{}.0/dev",
|
|
| 64 |
- "mount -t devpts -o gid=5,mode=620 devpts {}/ostree/deploy/photon/deploy/{}.0/dev/pts",
|
|
| 65 |
- "mount -t tmpfs -o defaults tmpfs {}/ostree/deploy/photon/deploy/{}.0/dev/shm",
|
|
| 66 |
- "mount -t proc -o defaults proc {}/ostree/deploy/photon/deploy/{}.0/proc",
|
|
| 67 |
- "mount -t bind -o bind,defaults /run {}/ostree/deploy/photon/deploy/{}.0/run",
|
|
| 68 |
- "mount -t sysfs -o defaults sysfs {}/ostree/deploy/photon/deploy/{}.0/sys" ]:
|
|
| 69 |
- self.run(command.format(self.photon_root, commit_number)) |
|
| 70 |
- |
|
| 71 |
- def get_commit_number(self, ref): |
|
| 72 |
- fileName = os.path.join(self.photon_root, "ostree/repo/refs/remotes/photon/{}".format(ref))
|
|
| 73 |
- commit_number = None |
|
| 74 |
- with open (fileName, "r") as file: |
|
| 75 |
- commit_number = file.read().replace('\n', '')
|
|
| 76 |
- return commit_number |
|
| 77 |
- |
|
| 78 |
- def unsafe_install(self, params): |
|
| 79 |
- self.org_photon_root = self.photon_root |
|
| 80 |
- sysroot_ostree = os.path.join(self.photon_root, "ostree") |
|
| 81 |
- sysroot_boot = os.path.join(self.photon_root, "boot") |
|
| 82 |
- loader0 = os.path.join(sysroot_boot, "loader.0") |
|
| 83 |
- loader1 = os.path.join(sysroot_boot, "loader.1") |
|
| 84 |
- |
|
| 85 |
- boot0 = os.path.join(sysroot_ostree, "boot.0") |
|
| 86 |
- boot1 = os.path.join(sysroot_ostree, "boot.1") |
|
| 87 |
- |
|
| 88 |
- boot01 = os.path.join(sysroot_ostree, "boot.0.1") |
|
| 89 |
- boot11 = os.path.join(sysroot_ostree, "boot.1.1") |
|
| 90 |
- |
|
| 91 |
- self.get_ostree_repo_url() |
|
| 92 |
- |
|
| 93 |
- self.window.show_window() |
|
| 94 |
- self.progress_bar.initialize("Initializing installation...")
|
|
| 95 |
- self.progress_bar.show() |
|
| 96 |
- |
|
| 97 |
- self.execute_modules(modules.commons.PRE_INSTALL) |
|
| 98 |
- |
|
| 99 |
- disk = self.install_config['disk']['disk'] |
|
| 100 |
- self.run("sgdisk -d 1 -d 2 -n 1::+2M -n 2::+300M -n 3: -p {}".format(disk), "Updating partition table for OSTree")
|
|
| 101 |
- self.run("sgdisk -t1:ef02 {}".format(disk))
|
|
| 102 |
- self.run("mkfs -t ext4 {}2".format(disk))
|
|
| 103 |
- self.run("mkfs -t ext4 {}3".format(disk))
|
|
| 104 |
- self.run("mount {}3 {}".format(disk, self.photon_root))
|
|
| 105 |
- self.run("mkdir -p {} ".format(sysroot_boot))
|
|
| 106 |
- self.run("mount {}2 {}".format(disk, sysroot_boot))
|
|
| 107 |
- |
|
| 108 |
- #Setup the disk |
|
| 109 |
- self.run("dd if=/dev/zero of={}/swapfile bs=1M count=64".format(self.photon_root))
|
|
| 110 |
- self.run("chmod 600 {}/swapfile".format(self.photon_root))
|
|
| 111 |
- self.run("mkswap -v1 {}/swapfile".format(self.photon_root))
|
|
| 112 |
- self.run("swapon {}/swapfile".format(self.photon_root))
|
|
| 113 |
- |
|
| 114 |
- if self.default_repo: |
|
| 115 |
- self.run("rm -rf /installer/boot")
|
|
| 116 |
- self.run("mkdir -p {}/repo".format(self.photon_root))
|
|
| 117 |
- self.progress_bar.show_loading("Unpacking local OSTree repo")
|
|
| 118 |
- self.run("tar --warning=none -xf /mnt/cdrom/ostree-repo.tar.gz -C {}/repo".format(self.photon_root))
|
|
| 119 |
- self.local_repo_path = "{}/repo".format(self.photon_root)
|
|
| 120 |
- self.ostree_repo_url = self.repo_config['OSTREEREPOURL'] |
|
| 121 |
- self.ostree_ref = self.repo_config['OSTREEREFS'] |
|
| 122 |
- self.progress_bar.update_loading_message("Unpacking done")
|
|
| 123 |
- |
|
| 124 |
- |
|
| 125 |
- self.deploy_ostree(self.ostree_repo_url, self.ostree_ref) |
|
| 126 |
- |
|
| 127 |
- self.run("swapoff -a")
|
|
| 128 |
- self.run("rm {}/swapfile".format(self.photon_root))
|
|
| 129 |
- |
|
| 130 |
- commit_number = self.get_commit_number(self.ostree_ref) |
|
| 131 |
- self.do_systemd_tmpfiles_commands(commit_number) |
|
| 132 |
- |
|
| 133 |
- self.mount_devices_in_deployment(commit_number) |
|
| 134 |
- deployment = os.path.join(self.photon_root, "ostree/deploy/photon/deploy/" + commit_number + ".0/") |
|
| 135 |
- |
|
| 136 |
- deployment_boot = os.path.join(deployment, "boot") |
|
| 137 |
- deployment_sysroot = os.path.join(deployment, "sysroot") |
|
| 138 |
- |
|
| 139 |
- self.run("mv {} {}".format(loader1, loader0))
|
|
| 140 |
- self.run("mv {} {}".format(boot1, boot0))
|
|
| 141 |
- self.run("mv {} {}".format(boot11, boot01))
|
|
| 142 |
- self.run("mount --bind {} {}".format(sysroot_boot, deployment_boot))
|
|
| 143 |
- self.run("mount --bind {} {}".format(self.photon_root, deployment_sysroot))
|
|
| 144 |
- self.run("chroot {} bash -c \"grub2-install /dev/sda\"".format(deployment))
|
|
| 145 |
- self.run("chroot {} bash -c \"grub2-mkconfig -o /boot/grub2/grub.cfg\"".format(deployment))
|
|
| 146 |
- self.run("mv {} {}".format(loader0, loader1))
|
|
| 147 |
- self.run("mv {} {}".format(boot0, boot1))
|
|
| 148 |
- self.run("mv {} {}".format(boot01, boot11))
|
|
| 149 |
- self.run("chroot {} bash -c \"ostree admin instutil set-kargs root=/dev/sda3 \"".format(deployment))
|
|
| 150 |
- sysroot_grub2_grub_cfg = os.path.join(self.photon_root, "boot/grub2/grub.cfg") |
|
| 151 |
- self.run("ln -sf ../loader/grub.cfg {}".format(sysroot_grub2_grub_cfg))
|
|
| 152 |
- self.run("mv {} {}".format(loader1, loader0))
|
|
| 153 |
- self.run("mv {} {}".format(boot1, boot0))
|
|
| 154 |
- self.run("mv {} {}".format(boot11, boot01))
|
|
| 155 |
- |
|
| 156 |
- |
|
| 157 |
- deployment_fstab = os.path.join(deployment, "etc/fstab") |
|
| 158 |
- self.run("echo \"/dev/sda3 / ext4 defaults,barrier,noatime,noacl,data=ordered 1 1 \" >> {} ".format(deployment_fstab), "Adding / mount point in fstab")
|
|
| 159 |
- self.run("echo \"/dev/sda2 /boot ext4 defaults 1 2 \" >> {} ".format(deployment_fstab), "Adding /boot mount point in fstab")
|
|
| 160 |
- self.run("mount --bind {} {}".format(deployment, self.photon_root))
|
|
| 161 |
- self.progress_bar.update_loading_message("Starting post install modules")
|
|
| 162 |
- self.execute_modules(modules.commons.POST_INSTALL) |
|
| 163 |
- self.progress_bar.update_loading_message("Unmounting disks")
|
|
| 164 |
- self.run("{} {} {}".format(self.unmount_disk_command, '-w', self.photon_root))
|
|
| 165 |
- self.progress_bar.update_loading_message("Ready to restart")
|
|
| 166 |
- self.progress_bar.hide() |
|
| 167 |
- self.window.addstr(0, 0, 'Congratulations, Photon RPM-OSTree Host has been installed in {0} secs.\n\nPress any key to continue to boot...'.format(self.progress_bar.time_elapsed))
|
|
| 168 |
- if self.ks_config == None: |
|
| 169 |
- self.window.content_window().getch() |
|
| 170 |
- return ActionResult(True, None) |
|
| 171 |
- |
| 172 | 1 |
deleted file mode 100755 |
| ... | ... |
@@ -1,49 +0,0 @@ |
| 1 |
-#!/usr/bin/python2 |
|
| 2 |
-# |
|
| 3 |
-# Copyright (C) 2015 vmware inc. |
|
| 4 |
-# |
|
| 5 |
-# Author: Mahmoud Bassiouny <mbassiouny@vmware.com> |
|
| 6 |
- |
|
| 7 |
-import json |
|
| 8 |
-import os |
|
| 9 |
-import curses |
|
| 10 |
-from sets import Set |
|
| 11 |
-from jsonwrapper import JsonWrapper |
|
| 12 |
-from menu import Menu |
|
| 13 |
-from window import Window |
|
| 14 |
-from actionresult import ActionResult |
|
| 15 |
- |
|
| 16 |
-class OSTreeServerSelector(object): |
|
| 17 |
- def __init__(self, maxy, maxx, install_config): |
|
| 18 |
- |
|
| 19 |
- self.install_config = install_config |
|
| 20 |
- self.maxx = maxx |
|
| 21 |
- self.maxy = maxy |
|
| 22 |
- self.win_width = 50 |
|
| 23 |
- self.win_height = 13 |
|
| 24 |
- |
|
| 25 |
- self.win_starty = (self.maxy - self.win_height) / 2 |
|
| 26 |
- self.win_startx = (self.maxx - self.win_width) / 2 |
|
| 27 |
- |
|
| 28 |
- self.menu_starty = self.win_starty + 3 |
|
| 29 |
- |
|
| 30 |
- self.menu_items = [] |
|
| 31 |
- self.menu_items.append(("Default RPM-OSTree Server", self.set_default_repo_installation, True))
|
|
| 32 |
- self.menu_items.append(("Custom RPM-OSTree Server", self.set_default_repo_installation, False))
|
|
| 33 |
- |
|
| 34 |
- self.host_menu = Menu(self.menu_starty, self.maxx, self.menu_items, |
|
| 35 |
- default_selected = 0, tab_enable=False) |
|
| 36 |
- |
|
| 37 |
- self.window = Window(self.win_height, self.win_width, self.maxy, self.maxx, |
|
| 38 |
- 'Select OSTree Server', True, items=[], tab_enabled = False, |
|
| 39 |
- position = 1, can_go_next=True) |
|
| 40 |
- self.window.set_action_panel(self.host_menu) |
|
| 41 |
- |
|
| 42 |
- def set_default_repo_installation(self, is_default_repo ): |
|
| 43 |
- self.install_config['default_repo'] = is_default_repo |
|
| 44 |
- return ActionResult(True, None) |
|
| 45 |
- |
|
| 46 |
- def display(self, params): |
|
| 47 |
- if self.install_config['type'] == 'ostree_host': |
|
| 48 |
- return self.window.do_action() |
|
| 49 |
- return ActionResult(True, None) |
| 50 | 1 |
deleted file mode 100755 |
| ... | ... |
@@ -1,17 +0,0 @@ |
| 1 |
-#!/usr/bin/python2 |
|
| 2 |
-# |
|
| 3 |
-# Copyright (C) 2015 vmware inc. |
|
| 4 |
-# |
|
| 5 |
-# Author: Mahmoud Bassiouny <mbassiouny@vmware.com> |
|
| 6 |
- |
|
| 7 |
-from windowstringreader import WindowStringReader |
|
| 8 |
-from actionresult import ActionResult |
|
| 9 |
- |
|
| 10 |
-class OSTreeWindowStringReader(WindowStringReader): |
|
| 11 |
- def __init__(self, maxy, maxx, height, width, field, confirmation_err_msg, echo_char, accepted_chars, validation_fn, conversion_fn, title, display_string, inputy, install_config, default_string = None): |
|
| 12 |
- WindowStringReader.__init__(self, maxy, maxx, height, width, field, confirmation_err_msg, echo_char, accepted_chars, validation_fn, conversion_fn, title, display_string, inputy, install_config, default_string) |
|
| 13 |
- |
|
| 14 |
- def get_user_string(self, params): |
|
| 15 |
- if self.install_config['type'] == 'ostree_host' and not self.install_config['default_repo']: |
|
| 16 |
- return self.window.do_action() |
|
| 17 |
- return ActionResult(True, None) |