Change update.info files to update.json, update the python generators, and docs.

This commit is contained in:
Steven Black
2016-12-09 20:59:43 -05:00
parent 6d414b758a
commit a6fcff9f22
37 changed files with 62 additions and 25 deletions

View File

@@ -87,7 +87,7 @@ defaults = {
"datafilenames" : "hosts",
"targetip" : "0.0.0.0",
"ziphosts" : False,
"updateurlfilename" : "update.info",
"sourcedatafilename" : "update.json",
"readmefilename" : "readme.md",
"readmetemplate" : os.path.join(BASEDIR_PATH, "readme_template.md"),
"readmedata" : {},
@@ -260,14 +260,14 @@ def updateAllSources():
print ("Skipping.")
def getUpdateURLsFromFile(source):
pathToUpdateFile = os.path.join(settings["datapath"], source, settings["updateurlfilename"])
pathToUpdateFile = os.path.join(settings["datapath"], source, settings["sourcedatafilename"])
if os.path.exists(pathToUpdateFile):
updateFile = open(pathToUpdateFile, "r")
retURLs = updateFile.readlines()
# .strip()
updateData = json.load(updateFile)
retURLs = [updateData["url"]]
updateFile.close()
else:
retURL = None
retURLs = None
printFailure("Warning: Can't find the update file for source " + source + "\n" +
"Make sure that there's a file at " + pathToUpdateFile)
return retURLs
@@ -275,10 +275,11 @@ def getUpdateURLsFromFile(source):
def getUpdateURLFromFile(source):
pathToUpdateFile = os.path.join(settings["datapath"], source, settings["updateurlfilename"])
pathToUpdateFile = os.path.join(settings["datapath"], source, settings["sourcedatafilename"])
if os.path.exists(pathToUpdateFile):
with open(pathToUpdateFile, "r") as updateFile:
return updateFile.readline().strip()
updateData = json.load(updateFile)
return [updateData["url"]]
printFailure("Warning: Can't find the update file for source " + source + "\n" +
"Make sure that there's a file at " + pathToUpdateFile)
return None