22 lines
419 B
Python
22 lines
419 B
Python
import json
|
|
|
|
SN_JSON_PATH = '/opt/tsg/etc/tsg_sn.json'
|
|
|
|
def tsg_get_sn():
|
|
try:
|
|
with open(SN_JSON_PATH) as json_fp:
|
|
json_dict = json.load(json_fp)
|
|
return json_dict['sn']
|
|
except IOError:
|
|
return ""
|
|
|
|
def main():
|
|
sn = tsg_get_sn()
|
|
if len(sn) > 0:
|
|
print("%s" %(sn))
|
|
else:
|
|
print("can't get sn")
|
|
|
|
if __name__ == '__main__':
|
|
main()
|