From 7bb5d95ac52d5d8091a21e51ff7c37437d6ca8b9 Mon Sep 17 00:00:00 2001 From: David Gillingham Date: Fri, 7 Sep 2012 12:29:36 -0500 Subject: [PATCH] Issue #1150: Fix regression caused by previous text product generation changes by ensuring all directories get created. Change-Id: I855b4afcc02e8b7c9e7f4d70b1a7ba3d449ff3c0 Former-commit-id: f192c8d115df33f752d1f4366da3b6aba83c3422 [formerly f192c8d115df33f752d1f4366da3b6aba83c3422 [formerly 74e7d98c5bde7cefaedf354ecfbac147b2ff801a]] Former-commit-id: 83681d1ff6046a6c412b17f43df9ad2bd21d3c3f Former-commit-id: 9d13d3244d35ad5e965e1473dfd4fc08edad1e67 --- .../edex_static/base/textproducts/Generator.py | 18 +++++++++++++----- .../plugin/gfe/textproducts/Configurator.java | 8 +++++++- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/edexOsgi/build.edex/esb/data/utility/edex_static/base/textproducts/Generator.py b/edexOsgi/build.edex/esb/data/utility/edex_static/base/textproducts/Generator.py index 7be3c78550..f15ea5c911 100755 --- a/edexOsgi/build.edex/esb/data/utility/edex_static/base/textproducts/Generator.py +++ b/edexOsgi/build.edex/esb/data/utility/edex_static/base/textproducts/Generator.py @@ -32,11 +32,13 @@ Jul 08, 2008 1222 jelkins Modified for use within Java Jul 09, 2008 1222 jelkins Split command line loader from class Jul 24, 2012 #944 dgilling Refactored to support separate generation of products and utilities. +Sep 07, 2012 #1150 dgilling Ensure all necessary dirs get created. @author: jelkins """ __version__ = "1.0" +import errno import os from os.path import basename from os.path import join @@ -129,14 +131,13 @@ class Generator(): @type value: string @raise IOError: when the directory does not exist or is not writable - """ - - from os import makedirs + """ try: - makedirs(value,0755) + os.makedirs(value, 0755) except OSError, e: - LOG.warn("%s: '%s'" % (e.strerror,e.filename)) + if e.errno != errno.EEXIST: + LOG.warn("%s: '%s'" % (e.strerror,e.filename)) self.__destination = value @@ -497,6 +498,13 @@ class Generator(): """ LOG.debug("Processing Formatter Templates.......") + try: + os.makedirs(join(self.getDestination(), destDir)) + except OSError, e: + if e.errno != errno.EEXIST: + LOG.error("%s: '%s'" % (e.strerror,e.filename)) + return 0 + siteid = self.__siteId productsWritten = 0 diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/textproducts/Configurator.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/textproducts/Configurator.java index 7fa29754f0..253143435d 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/textproducts/Configurator.java +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/textproducts/Configurator.java @@ -62,6 +62,8 @@ import com.raytheon.uf.edex.database.cluster.ClusterTask; * Jul 7, 2008 1222 jelkins Initial creation * Jul 24,2012 #944 dgilling Fix text product template generation * to create textProducts and textUtilities. + * Sep 07,2012 #1150 dgilling Fix isConfigured to check for textProducts + * and textUtilities dirs. * * * @@ -158,7 +160,11 @@ public class Configurator { task.getLastExecution(), true); // if the destination dir does not exist, configurator needs run - if (!new File(destinationDirectory).exists()) { + + if ((!new File(FileUtil.join(destinationDirectory, "textProducts")) + .isDirectory()) + || (!new File(FileUtil.join(destinationDirectory, + "textUtilities")).isDirectory())) { filesHaveChanges = true; }