judge key exists first.

This commit is contained in:
andyliuliming
2016-03-03 17:10:38 +08:00
parent 3c2160b92b
commit 1cdc19df21
+2 -2
View File
@@ -1120,7 +1120,7 @@ class SuSEDistro(AbstractDistro):
if rdma_pack_result is None :
Log("repository with name %s is not found" % repository["Name"])
gpgCheckFlag = '-g'
if repository["GpgCheck"] == 'n':
if repository.has_key("GpgCheck") and repository["GpgCheck"] == 'n':
gpgCheckFlag = '-G'
command_to_add_repository = self.zypper_path + " ar " + gpgCheckFlag + " " + str(repository["Url"]) + " " + repository["Name"]
error, output = RunGetOutput(command_to_add_repository)
@@ -1420,7 +1420,7 @@ class centosDistro(redhatDistro):
if(not os.path.exists(repo_file_path)):
Log("repository with name %s is not found" % repository["Name"])
gpgCheckFlag = '1'
if repository["GpgCheck"] == 'n':
if repository.has_key("GpgCheck") and repository["GpgCheck"] == 'n':
gpgCheckFlag = '0'
repo_content = "[" + repository["Name"] + "]\n"\
+ "name=" + repository["Name"] + "\n"\