Commit cf982bf0 authored by Joanne Hugé's avatar Joanne Hugé

playbook/ors: add get-license-info

parent 01305f64
#!/usr/bin/env python3
import argparse, os, re, sys
parser = argparse.ArgumentParser()
parser.add_argument('-e', '--expiration', action='store_true')
parser.add_argument('-v', '--version', action='store_true')
args = parser.parse_args()
amarisoft_dir = '/opt/amarisoft'
try:
lte_version = sorted(filter(lambda x: re.match(r"v[0-9]{4}-[0-9]{2}-[0-9]{2}", x), os.listdir(amarisoft_dir)))[-1][1:]
except FileNotFoundError:
lte_version = 'Unknown'
lte_expiration = "Unknown"
try:
for filename in os.listdir(amarisoft_dir + '/.amarisoft'):
if filename.endswith('.key'):
with open(os.path.join(amarisoft_dir + '/.amarisoft', filename), 'r') as f:
f.seek(260)
for l in f:
if l.startswith('version='):
lte_expiration = l.split('=')[1].strip()
except FileNotFoundError:
pass
if args.expiration:
print(lte_expiration, end='')
elif args.version:
print(lte_version, end='')
......@@ -64,6 +64,9 @@
- name: Copy get-sdr-info script
copy: src=get-sdr-info dest=/opt/amarisoft owner=root mode=770
- name: Copy get-license-info script
copy: src=get-license-info dest=/opt/amarisoft owner=root mode=770
# Re6st
- name: Configure re6st
......
087f0c7a760654c2411c91c39d56a86ec2e8e3147a0076945b3152a86b3701b1 -
a0c509f6bba4a62a2dbefe8e79b32f05ef4026e7e763bae5ec6db5d1e173a723 -
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment