Commit cf4cacd78f39c1b3abe956eef1d317cd65a73403
1 parent
6ceba60f58
Exists in
master
remove overlimit products
Showing 1 changed file with 17 additions and 0 deletions Side-by-side Diff
main.py
... | ... | @@ -5,6 +5,7 @@ from logging.handlers import TimedRotatingFileHandler |
5 | 5 | import ConfigParser |
6 | 6 | import json |
7 | 7 | from os import getpid |
8 | +import os | |
8 | 9 | import re |
9 | 10 | import signal |
10 | 11 | import sys |
... | ... | @@ -708,6 +709,20 @@ def updateChipInfo(msisdn): |
708 | 709 | CHIPINFO = BASE_CHIPINFO + '-' + msisdn |
709 | 710 | |
710 | 711 | logger.info('CHIPINFO: {0}'.format(CHIPINFO)) |
712 | + | |
713 | +def removeOverLimitProducts(): | |
714 | + global PRODUCTS | |
715 | + | |
716 | + if os.path.isfile('XL5.deny'): | |
717 | + sate24.removeProduct(PRODUCTS, 'XL5') | |
718 | + | |
719 | + if os.path.isfile('XL10.deny'): | |
720 | + sate24.removeProduct(PRODUCTS, 'XL10') | |
721 | + | |
722 | + if os.path.isfile('ALL.deny'): | |
723 | + sate24.removeProduct(PRODUCTS, 'XL5') | |
724 | + sate24.removeProduct(PRODUCTS, 'XL10') | |
725 | + | |
711 | 726 | |
712 | 727 | def main(): |
713 | 728 | global logger |
... | ... | @@ -775,6 +790,8 @@ def main(): |
775 | 790 | checkAccount(modem) |
776 | 791 | sleep(5) |
777 | 792 | |
793 | + removeOverLimitProducts() | |
794 | + | |
778 | 795 | enablePull() |
779 | 796 | |
780 | 797 | checkBalance(modem) |