aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Reyna <David.Reyna@windriver.com>2019-02-19 17:53:15 -0800
committerDavid Reyna <David.Reyna@windriver.com>2019-02-19 17:53:15 -0800
commit990e6e9cda7a999bd6ef5168786ae69928f4037c (patch)
tree003615f2385688ee03e12b27d2120f70b4a3c819
parentf31c18ff2e87589793f3d6a097dc3e960ae1b0b4 (diff)
downloadsrtool-990e6e9cda7a999bd6ef5168786ae69928f4037c.tar.gz
srtool-990e6e9cda7a999bd6ef5168786ae69928f4037c.tar.bz2
srtool-990e6e9cda7a999bd6ef5168786ae69928f4037c.zip
srtool_update: fix product/user update from tables
When restarting the SRTool, the main app's user and product table should be re-read and applied. This fixes a select problem. Signed-off-by: David Reyna <David.Reyna@windriver.com>
-rwxr-xr-xbin/acme/srtool_acme.py6
-rwxr-xr-xbin/common/srtool_common.py16
-rwxr-xr-xbin/yp/srtool_yp.py6
3 files changed, 22 insertions, 6 deletions
diff --git a/bin/acme/srtool_acme.py b/bin/acme/srtool_acme.py
index 0e33de0e..1aa1b911 100755
--- a/bin/acme/srtool_acme.py
+++ b/bin/acme/srtool_acme.py
@@ -99,7 +99,7 @@ def init_products(source_file):
defect_tags = Product_Item['defect_tags']
product_tags = Product_Item['product_tags']
- sql = "SELECT 1 FROM orm_product WHERE key = '%s'" % (key, )
+ sql = "SELECT * FROM orm_product WHERE key = '%s'" % (key, )
product = cur.execute(sql).fetchone()
if product is None:
# NOTE: 'order' is a reserved SQL keyword, so we have to quote it
@@ -107,9 +107,9 @@ def init_products(source_file):
cur.execute(sql, (order, key, name, version, profile, cpe, defect_tags, product_tags))
else:
sql = ''' UPDATE orm_product
- SET "order" = ?, cpe= ?, defect_tags=?, product_tags=?
+ SET "order" = ?, key = ?, name = ?, version = ?, profile = ?, cpe= ?, defect_tags=?, product_tags=?
WHERE id=?'''
- cur.execute(sql, (order, cpe, defect_tags, product_tags, product[ORM.PRODUCT_ID]))
+ cur.execute(sql, (order, key, name, version, profile, cpe, defect_tags, product_tags, product[ORM.PRODUCT_ID]))
conn.commit()
#################################
diff --git a/bin/common/srtool_common.py b/bin/common/srtool_common.py
index a098fc7e..66e980af 100755
--- a/bin/common/srtool_common.py
+++ b/bin/common/srtool_common.py
@@ -452,6 +452,9 @@ def gen_schema_header():
fd.write(" %s_%s = %d\n" % ('PRIORITY','LOW' ,2))
fd.write(" %s_%s = %d\n" % ('PRIORITY','MEDIUM' ,3))
fd.write(" %s_%s = %d\n" % ('PRIORITY','HIGH' ,4))
+ fd.write(" %s = '%s'\n" % ('PRIORITY_STR', \
+ 'Undefined,Minor,Low,Medium,High' \
+ ))
fd.write(" %s_%s = %d\n" % ('STATUS','HISTORICAL' ,0))
fd.write(" %s_%s = %d\n" % ('STATUS','NEW' ,1))
@@ -459,6 +462,9 @@ def gen_schema_header():
fd.write(" %s_%s = %d\n" % ('STATUS','INVESTIGATE' ,3))
fd.write(" %s_%s = %d\n" % ('STATUS','VULNERABLE' ,4))
fd.write(" %s_%s = %d\n" % ('STATUS','NOT_VULNERABLE',5))
+ fd.write(" %s = '%s'\n" % ('STATUS_STR', \
+ 'Historical,New,New_Reserved,Investigate,Vulnerable,Not_Vulnerable' \
+ ))
fd.write(" %s_%s = %d\n" % ('PUBLISH','UNPUBLISHED',0))
fd.write(" %s_%s = %d\n" % ('PUBLISH','NOPUBLISH',1))
@@ -466,11 +472,17 @@ def gen_schema_header():
fd.write(" %s_%s = %d\n" % ('PUBLISH','REQUEST',3))
fd.write(" %s_%s = %d\n" % ('PUBLISH','UPDATE',4))
fd.write(" %s_%s = %d\n" % ('PUBLISH','SUBMITTED',5))
+ fd.write(" %s = '%s'\n" % ('PUBLISH_STR', \
+ 'Unpublished,Nopublish,Published,Request,Update,Submitted' \
+ ))
fd.write(" %s_%s = %d\n" % ('OUTCOME','OPEN' ,0))
fd.write(" %s_%s = %d\n" % ('OUTCOME','CLOSED' ,1))
fd.write(" %s_%s = %d\n" % ('OUTCOME','FIXED' ,2))
fd.write(" %s_%s = %d\n" % ('OUTCOME','NOT_FIX',3))
+ fd.write(" %s = '%s'\n" % ('OUTCOME_STR', \
+ 'Open,Closed,Fixed,Not_Fix' \
+ ))
fd.write(" %s_%s = %d\n" % ('DEFECT','UNRESOLVED' ,0))
fd.write(" %s_%s = %d\n" % ('DEFECT','RESOLVED' ,1))
@@ -483,6 +495,9 @@ def gen_schema_header():
fd.write(" %s_%s = %d\n" % ('DEFECT','REPLACED_BY_REQUIREMENT' ,8))
fd.write(" %s_%s = %d\n" % ('DEFECT','CANNOT_REPRODUCE' ,9))
fd.write(" %s_%s = %d\n" % ('DEFECT','DONE' ,10))
+ fd.write(" %s_%s = '%s'\n" % ('DEFECT','RESOLUTION_STR', \
+ 'Unresolved,Resolved,Fixed,Will_Not_Fix,Withdrawn,Rejected,Duplicate,Not_Applicable,Replaced_By_Requirement,Cannot_Reproduce,Done' \
+ ))
fd.write(" %s_%s = %d\n" % ('PACKAGE','FOR' ,0))
fd.write(" %s_%s = %d\n" % ('PACKAGE','AGAINST' ,1))
@@ -504,6 +519,7 @@ def gen_schema_header():
fd.write(" # General routine to return string name of a constant (e.g. 'DATASOURCE_FREQUENCY_STR')\n")
fd.write(" @staticmethod\n")
fd.write(" def get_orm_string(value,string_set):\n")
+ fd.write(" if None == value: return('None')\n")
fd.write(" string_list = string_set.split(',')\n")
fd.write(" string_count = len(string_list)\n")
fd.write(" value = int(value)\n")
diff --git a/bin/yp/srtool_yp.py b/bin/yp/srtool_yp.py
index 6caa7863..338d4467 100755
--- a/bin/yp/srtool_yp.py
+++ b/bin/yp/srtool_yp.py
@@ -90,7 +90,7 @@ def init_products(source_file):
defect_tags = Product_Item['defect_tags']
product_tags = Product_Item['product_tags']
- sql = "SELECT 1 FROM orm_product WHERE key = '%s'" % (key, )
+ sql = "SELECT * FROM orm_product WHERE key = '%s'" % (key, )
product = cur.execute(sql).fetchone()
if product is None:
# NOTE: 'order' is a reserved SQL keyword, so we have to quote it
@@ -98,9 +98,9 @@ def init_products(source_file):
cur.execute(sql, (order, key, name, version, profile, cpe, defect_tags, product_tags))
else:
sql = ''' UPDATE orm_product
- SET "order" = ?, cpe= ?, defect_tags=?, product_tags=?
+ SET "order" = ?, key = ?, name = ?, version = ?, profile = ?, cpe= ?, defect_tags=?, product_tags=?
WHERE id=?'''
- cur.execute(sql, (order, cpe, defect_tags, product_tags, product[ORM.PRODUCT_ID]))
+ cur.execute(sql, (order, key, name, version, profile, cpe, defect_tags, product_tags, product[ORM.PRODUCT_ID]))
conn.commit()
#################################