Esempio n. 1
0
 def test01_download_sku_packs(self):
     # Download SKU packs from GitHub
     rc = subprocess.call("rm -rf temp.sku; rm -rf on-skupack;mkdir -p on-skupack", shell=True)
     self.assertEqual(rc, 0, "Unable to make on-skupack directory")
     # download all SKU repos and merge into on-skupack
     for url in fit_common.fitskupack():
         print "**** Cloning SKU Packs from " + url
         subprocess.call("git clone " + url + " temp.sku", shell=True)
         subprocess.call('cp -R temp.sku/* on-skupack; rm -rf temp.sku', shell=True)
Esempio n. 2
0
 def test01_download_sku_packs(self):
     # Download SKU packs from GitHub
     rc = subprocess.call(
         "rm -rf temp.sku; rm -rf on-skupack;mkdir -p on-skupack",
         shell=True)
     self.assertEqual(rc, 0, "Unable to make on-skupack directory")
     # download all SKU repos and merge into on-skupack
     for url in fit_common.fitskupack():
         print "**** Cloning SKU Packs from " + url
         subprocess.call("git clone " + url + " temp.sku", shell=True)
         subprocess.call('cp -R temp.sku/* on-skupack; rm -rf temp.sku',
                         shell=True)
Esempio n. 3
0
 def test02_preload_sku_packs(self):
     print "**** Processing SKU Packs"
     # Load SKU packs from GutHub
     subprocess.call("rm -rf temp.sku; rm -rf on-skupack", shell=True)
     os.mkdir("on-skupack")
     # download all SKU repos and merge into on-skupack
     for url in fit_common.fitskupack():
         print "**** Cloning SKU Packs from " + url
         subprocess.call("git clone " + url + " temp.sku", shell=True)
         subprocess.call('cp -R temp.sku/* on-skupack; rm -rf temp.sku', shell=True)
     # build build SKU packs
     for subdir, dirs, files in os.walk('on-skupack'):
         for skus in dirs:
             if skus not in ["debianstatic", ".git"] and os.path.isfile('on-skupack/' + skus + '/config.json'):
                 subprocess.call("cd on-skupack;mkdir -p " + skus + "/tasks " + skus + "/static "
                                 + skus + "/workflows " + skus + "/templates", shell=True)
                 subprocess.call("cd on-skupack; ./build-package.bash "
                                 + skus + " " + skus + " >/dev/null 2>&1", shell=True)
         break
     # upload SKU packs to ORA
     print "**** Loading SKU Packs to server"
     for subdir, dirs, files in os.walk('on-skupack/tarballs'):
         for skupacks in files:
             print "\n**** Loading SKU Pack for " + skupacks
             fit_common.rackhdapi("/api/2.0/skus/pack", action="binary-post",
                                  payload=file(fit_common.TEST_PATH + "on-skupack/tarballs/" + skupacks).read())
         break
     print "\n"
     # check SKU directory against source files
     errorcount = ""
     skulist = json.dumps(fit_common.rackhdapi("/api/2.0/skus")['json'])
     for subdir, dirs, files in os.walk('on-skupack'):
         for skus in dirs:
             if skus not in ["debianstatic", ".git", "packagebuild", "tarballs"] and \
                os.path.isfile('on-skupack/' + skus + '/config.json'):
                 try:
                     configfile = json.loads(open("on-skupack/" + skus  + "/config.json").read())
                     # check if sku pack got installed
                     if configfile['name'] not in skulist:
                         print "FAILURE - Missing SKU: " + configfile['name']
                         errorcount += "  Missing SKU: " + configfile['name']
                 except:
                     # Check is the sku pack config.json file is valid format, fails skupack install if invalid
                     print "FAILURE - Corrupt config.json in SKU Pack: " + str(skus) + " - not loaded"
                     errorcount += "  Corrupt config.json in SKU Pack: " + str(skus)
         break
     self.assertEqual(errorcount, "", errorcount)
Esempio n. 4
0
 def test02_preload_sku_packs(self):
     log.info_5("**** Downloading SKU packs from GitHub")
     subprocess.call("rm -rf temp.sku; rm -rf on-skupack", shell=True)
     os.mkdir("on-skupack")
     # download all SKU repos and merge into on-skupack
     for url in fit_common.fitskupack():
         log.info_5("**** Cloning SKU Packs from " + url)
         subprocess.call("git clone " + url + " temp.sku", shell=True)
         subprocess.call('cp -R temp.sku/* on-skupack; rm -rf temp.sku', shell=True)
     # build build SKU packs
     for subdir, dirs, files in os.walk('on-skupack'):
         for skus in dirs:
             if skus not in ["debianstatic", ".git"] and os.path.isfile('on-skupack/' + skus + '/config.json'):
                 subprocess.call("cd on-skupack;mkdir -p " + skus + "/tasks " + skus + "/static " +
                                 skus + "/workflows " + skus + "/templates", shell=True)
                 subprocess.call("cd on-skupack; ./build-package.bash " +
                                 skus + " " + skus + " >/dev/null 2>&1", shell=True)
         break
     # upload SKU packs to ORA
     log.info_5("**** Loading SKU Packs to server")
     for subdir, dirs, files in os.walk('on-skupack/tarballs'):
         for skupacks in files:
             log.info_5("**** Loading SKU Pack for " + skupacks)
             file = open(fit_common.TEST_PATH + "on-skupack/tarballs/" + skupacks)
             fit_common.rackhdapi("/api/2.0/skus/pack", action="binary-post", payload=file.read())
             file.close()
         break
     # check SKU directory against source files
     error_message = ""
     skulist = json.dumps(fit_common.rackhdapi("/api/2.0/skus")['json'])
     for subdir, dirs, files in os.walk('on-skupack'):
         for skus in dirs:
             if skus not in ["debianstatic", ".git", "packagebuild", "tarballs"] and \
                os.path.isfile('on-skupack/' + skus + '/config.json'):
                 try:
                     configfile = json.loads(open("on-skupack/" + skus + "/config.json").read())
                     # check if sku pack got installed
                     if configfile['name'] not in skulist:
                         log.error("FAILURE - Missing SKU: " + configfile['name'])
                         error_message += "  Missing SKU: " + configfile['name']
                 except:
                     # Check is the sku pack config.json file is valid format, fails skupack install if invalid
                     log.error("FAILURE - Corrupt config.json in SKU Pack: " + str(skus) + " - not loaded")
                     error_message += "  Corrupt config.json in SKU Pack: " + str(skus)
         break
     self.assertEqual(error_message, "", error_message)