1
0
Fork 0
mirror of https://github.com/fastogt/pyfastogt synced 2025-02-12 10:51:51 +00:00
This commit is contained in:
atopilski 2021-03-01 10:41:31 -05:00
parent 84fb572d74
commit 903e4d9e07
2 changed files with 14 additions and 3 deletions

View file

@ -1,4 +1,5 @@
#!/usr/bin/env python3
import configparser
import subprocess
import sys
from datetime import datetime
@ -24,9 +25,10 @@ def print_usage():
PROJECTS = ['fastocloud', 'fastocloud_pro', 'fastocloud_pro_ml', 'fastocloud_load_balance', 'fastocloud_epg']
if __name__ == "__main__":
project_line = 'Please select project number: \n'
project_line = 'Please choose project: \n'
for i, proj in enumerate(PROJECTS):
project_line += '{0} ({1})\n'.format(proj, i)
project_line += 'Select appropriate number [0-{0}]: '.format(len(PROJECTS) - 1)
while True:
email = input('Please input your email: ')
@ -57,7 +59,16 @@ if __name__ == "__main__":
response = {'error': 'Invalid response'}
if r.status_code == 200 or r.status_code == 201:
print(response['exp_license'])
exp_license = response['exp_license']
print('license_key={0}'.format(exp_license))
config = configparser.ConfigParser()
config_path = '/etc/{0}.conf'.format(project)
config.read(config_path)
config.set('settings', 'license_key', exp_license)
with open(config_path, 'w') as f:
config.write(f, space_around_delimiters=False)
print('Successful installed license key for {0}'.format(project))
sys.exit(0)
print('Request failed, status code: {0}, error: {1}'.format(r.status_code, response['error']))

View file

@ -121,6 +121,6 @@ setup(
cmdclass={
'upload': UploadCommand
},
scripts=['pyfastogt/exe/request_fastogt_license_key', 'pyfastogt/exe/request_fastogt_license_key_input',
scripts=['pyfastogt/exe/request_fastogt_license_key', 'pyfastogt/exe/set_fastogt_license_key',
'pyfastogt/exe/regenerate_machine_id']
)