mirror of
https://github.com/fastogt/pyfastogt
synced 2025-02-12 13:51:53 +00:00
Set key
This commit is contained in:
parent
84fb572d74
commit
903e4d9e07
2 changed files with 14 additions and 3 deletions
|
@ -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']))
|
2
setup.py
2
setup.py
|
@ -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']
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue