Browse code

Adding ks support to install ostree server

Have the kickstart support installing ostree server.

Mahmoud Bassiouny authored on 2015/08/11 08:40:51
Showing 11 changed files
... ...
@@ -3,45 +3,45 @@
3 3
         "title" : "ISO Packages",
4 4
         "file" : "packages_iso.json",
5 5
         "visible" : false,
6
-        "include" : "none"
6
+        "include" : []
7 7
     },
8 8
     "micro" : {
9 9
         "title" : "1. Photon Micro",
10 10
         "file" : "packages_micro.json",
11 11
         "visible" : true,
12
-        "include" : "none"
12
+        "include" : []
13 13
 
14 14
     },
15 15
     "minimal" : {
16 16
         "title" : "2. Photon Minimal",
17 17
         "file" : "packages_minimal.json",
18 18
         "visible" : true,
19
-        "include" : "none"
19
+        "include" : []
20 20
     },
21 21
     "full" : {
22 22
         "title" : "3. Photon Full",
23 23
         "file" : "packages_full.json",
24 24
         "visible" : true,
25
-        "include" : "minimal"
25
+        "include" : ["minimal"]
26 26
     },
27 27
     "ostree_host" : {
28 28
         "title" : "4. Photon OSTree Host",
29 29
         "file" : "packages_ostree_host.json",
30 30
         "visible" : true,
31
-        "include" : "none",
31
+        "include" : [],
32 32
         "additional-files" : ["ostree-repo.tar.gz"]
33 33
     },
34 34
     "ostree_server" : {
35 35
         "title" : "5. Photon OSTree Server",
36 36
         "file" : "packages_ostree_server.json",
37 37
         "visible" : true,
38
-        "include" : "minimal",
38
+        "include" : ["minimal"],
39 39
         "additional-files" : ["ostree-repo.tar.gz"]
40 40
     },
41 41
     "extra" : {
42 42
         "title" : "Extra packages not installed but packed in ISO.",
43 43
         "file" : "packages_extra.json",
44 44
         "visible" : false,
45
-        "include" : "none"
45
+        "include" : []
46 46
     }
47 47
 }
... ...
@@ -3,18 +3,18 @@
3 3
         "title" : "ISO Packages",
4 4
         "file" : "packages_iso.json",
5 5
         "visible" : false,
6
-        "include" : "none"
6
+        "include" : []
7 7
     },
8 8
     "minimal" : {
9 9
         "title" : "Photon Minimal",
10 10
         "file" : "packages_minimal.json",
11 11
         "visible" : true,
12
-        "include" : "none"
12
+        "include" : []
13 13
     },
14 14
     "ami" : {
15 15
         "title" : "Photon AMI packages",
16 16
         "file" : "packages_ami.json",
17 17
         "visible" : false,
18
-        "include" : "minimal"
18
+        "include" : ["minimal"]
19 19
     }
20 20
 }
... ...
@@ -3,18 +3,18 @@
3 3
         "title" : "ISO Packages",
4 4
         "file" : "packages_iso.json",
5 5
         "visible" : false,
6
-        "include" : "none"
6
+        "include" : []
7 7
     },
8 8
     "minimal" : {
9 9
         "title" : "Photon Minimal",
10 10
         "file" : "packages_minimal.json",
11 11
         "visible" : true,
12
-        "include" : "none"
12
+        "include" : []
13 13
     },
14 14
     "azure" : {
15 15
         "title" : "Photon Azure packages",
16 16
         "file" : "packages_azure.json",
17 17
         "visible" : false,
18
-        "include" : "minimal"
18
+        "include" : ["minimal"]
19 19
     }
20 20
 }
... ...
@@ -3,18 +3,18 @@
3 3
         "title" : "ISO Packages",
4 4
         "file" : "packages_iso.json",
5 5
         "visible" : false,
6
-        "include" : "none"
6
+        "include" : []
7 7
     },
8 8
     "minimal" : {
9 9
         "title" : "Photon Minimal",
10 10
         "file" : "packages_minimal.json",
11 11
         "visible" : true,
12
-        "include" : "none"
12
+        "include" : []
13 13
     },
14 14
     "gce" : {
15 15
         "title" : "Photon GCE packages",
16 16
         "file" : "packages_gce.json",
17 17
         "visible" : false,
18
-        "include" : "minimal"
18
+        "include" : ["minimal"]
19 19
     }
20 20
 }
... ...
@@ -3,7 +3,7 @@
3 3
         "title" : "Live CD Packages",
4 4
         "file" : "packages_minimal.json",
5 5
         "visible" : false,
6
-        "include" : "none",
6
+        "include" : [],
7 7
         "live-cd" : true
8 8
     }
9 9
 }
... ...
@@ -3,12 +3,12 @@
3 3
         "title" : "ISO Packages",
4 4
         "file" : "packages_iso.json",
5 5
         "visible" : false,
6
-        "include" : "none"
6
+        "include" : []
7 7
     },
8 8
     "micro" : {
9 9
         "title" : "Photon Micro",
10 10
         "file" : "packages_micro.json",
11 11
         "visible" : true,
12
-        "include" : "none"
12
+        "include" : []
13 13
     }
14 14
 }
... ...
@@ -3,12 +3,12 @@
3 3
         "title" : "ISO Packages",
4 4
         "file" : "packages_iso.json",
5 5
         "visible" : false,
6
-        "include" : "none"
6
+        "include" : []
7 7
     },
8 8
     "minimal" : {
9 9
         "title" : "Photon Minimal",
10 10
         "file" : "packages_minimal.json",
11 11
         "visible" : true,
12
-        "include" : "none"
12
+        "include" : []
13 13
     }
14 14
 }
... ...
@@ -3,13 +3,13 @@
3 3
         "title" : "ISO Packages",
4 4
         "file" : "packages_iso.json",
5 5
         "visible" : false,
6
-        "include" : "none"
6
+        "include" : []
7 7
     },
8 8
     "ostree_host" : {
9 9
         "title" : "4. Photon OSTree Host",
10 10
         "file" : "packages_ostree_host.json",
11 11
         "visible" : true,
12
-        "include" : "none",
12
+        "include" : [],
13 13
         "additional-files" : ["ostree-repo.tar.gz"]
14 14
     }
15 15
 }
... ...
@@ -3,12 +3,12 @@
3 3
         "title" : "ISO Packages",
4 4
         "file" : "packages_iso.json",
5 5
         "visible" : false,
6
-        "include" : "none"
6
+        "include" : []
7 7
     },
8 8
     "minimal" : {
9 9
         "title" : "Photon Minimal",
10 10
         "file" : "packages_minimal.json",
11 11
         "visible" : true,
12
-        "include" : "none"
12
+        "include" : []
13 13
     }
14 14
 }
... ...
@@ -5,22 +5,23 @@ from jsonwrapper import JsonWrapper
5 5
 install_phase = commons.PRE_INSTALL
6 6
 enabled = True
7 7
 
8
+def get_packages_to_install(options, config_type):
9
+        package_list = []
10
+        install_option = options[config_type]
11
+        for include_type in install_option["include"]:
12
+            package_list = package_list + get_packages_to_install(options, include_type)
13
+        json_wrapper_package_list = JsonWrapper(install_option["file"])
14
+        package_list_json = json_wrapper_package_list.read()
15
+        package_list = package_list + package_list_json["packages"]
16
+
17
+        return package_list
18
+
8 19
 def execute(name, ks_config, config, root):
9 20
 
10 21
     if ks_config:
11
-        package_list_micro = JsonWrapper("packages_micro.json").read()
12
-        package_list_minimal = JsonWrapper("packages_minimal.json").read()
13
-        package_list_full = JsonWrapper("packages_full.json").read()
14
-
15
-        if ks_config['type'] == 'micro':
16
-            packages = package_list_micro["packages"]
17
-        elif ks_config['type'] == 'minimal':
18
-            packages = package_list_minimal["packages"]
19
-        elif ks_config['type'] == 'full':
20
-            packages = package_list_minimal["packages"] + package_list_full["packages"]
21
-        else:
22
-            #TODO: error
23
-            packages = []
22
+
23
+        options = JsonWrapper("build_install_options_all.json").read()
24
+        packages = get_packages_to_install(options, ks_config['type'])
24 25
 
25 26
         if 'additional_packages' in ks_config:
26 27
             packages.extend(ks_config['additional_packages'])
... ...
@@ -35,9 +35,8 @@ class PackageSelector(object):
35 35
         package_list = []
36 36
         for install_option in options:
37 37
             if install_option[0] == config_type:
38
-                if install_option[1]["include"] != "none":
39
-                    for include_type in install_option[1]["include"].split(','):
40
-                        package_list = package_list + PackageSelector.get_packages_to_install(options, base_path, include_type)
38
+                for include_type in install_option[1]["include"]:
39
+                    package_list = package_list + PackageSelector.get_packages_to_install(options, base_path, include_type)
41 40
                 json_wrapper_package_list = JsonWrapper(os.path.join(base_path, install_option[1]["file"]))
42 41
                 package_list_json = json_wrapper_package_list.read()
43 42
                 package_list = package_list + package_list_json["packages"]