add monthlyFeeMonths, upgradeRequiresApproval
smbaker [Wed, 10 Oct 2012 02:03:57 +0000 (19:03 -0700)]
apps/gacks/gackspolicy.py
apps/gacks/policy.d/gold.conf

index c734eae..0c2af36 100644 (file)
@@ -22,14 +22,16 @@ class GacksPolicy:
         self.cost = 1                 # cost/hr in cents
         self.reservations = []
         self.upgradeFrom = []
+        self.upgradeRequiresApproval = False
         self.term = 0
         self.monthlyFee = 0
+        self.monthlyFeeMonths = 12   # how often to charge the monthly fee, 1=monthly, 3=quarterly, 12=yearly
 
     def dump(self):
         print self.name
         print "   resource:", self.resource
         print "   description:", self.description
-        print "   upgradeFrom:", ",".join(self.upgradeFrom), "  term:", self.term, "  monthly fee:", self.monthlyFee
+        print "   upgradeFrom:", ",".join(self.upgradeFrom), "  requires approval:", self.upgradeRequiresApproval, "  term:", self.term, "  monthly fee:", self.monthlyFee,  "months:", self.monthlyFeeMonths
         if self.maxUnitsConcurrent>=0:
            print "   maxUnitsConcurrent:", self.maxUnitsConcurrent
         if self.maxUnitsNode>=0:
@@ -94,14 +96,18 @@ class GacksPolicyDirectory:
         resources = [x.strip() for x in resources]
         upgradeFrom = parser.GetOpt("policy", "upgradeFrom", "").split(",")
         upgradeFrom = [x.strip() for x in upgradeFrom]
+        upgradeRequiresApproval = parser.GetOptBool("policy", "upgradeRequiresApproval", "False")
         term = parser.GetOptInt("policy", "term", 0)
         monthlyFee = parser.GetOptInt("policy", "monthlyFee", 0)
+        monthlyFeeMonths = parser.GetOptInt("policy", "monthlyFeeMonths", 1)
 
         for section in resources:
             p = GacksPolicy(name=name, description=description, resource=section)
 
             p.description = parser.GetOpt(section, "description", description)
             p.upgradeFrom = upgradeFrom
+            p.upgradeRequiresApproval = upgradeRequiresApproval
+            p.monthlyFeeMonths = monthlyFeeMonths
             p.maxUnitsConcurrent = parser.GetOptInt(section, "maxUnitsConcurrent", -1)
             p.maxUnitsNode = parser.GetOptInt(section, "maxUnitsNode", -1)
             p.maxUnitsDay = parser.GetOptInt(section, "maxUnitsDay", -1)
index 2be8851..6c64eb9 100644 (file)
@@ -3,8 +3,10 @@ name = gold
 description = Gold
 resources = plc.vicci.cores, cycles
 upgradeFrom = default, silver
+upgradeRequiresApproval = true
 term = 12
-monthlyFee = 100
+monthlyFee = 1500
+monthlyFeeMonths = 12
 
 [plc.vicci.cores]
 reservations = calendar