Use YAML formatted variable file

This commit is contained in:
Daniel Berteaud 2018-12-20 13:15:42 +01:00
parent a95690d862
commit 6efc37b8e2
2 changed files with 6 additions and 8 deletions

View File

@ -1,5 +1,5 @@
package : fws-fusioninventory
version : 2.4.2-11
version : 2.4.2-12
architecture : all
section : base
priority : optional

View File

@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
from setuphelpers import *
from cryptography.fernet import Fernet
import json
uninstallkey = []
@ -12,8 +10,10 @@ variables = {
# Read local variables file if available
if isfile(makepath(programfiles32,'wapt','private','symetric.txt')) and isfile(makepath(programfiles32,'wapt','private','variables.txt')):
print('Reading local encrypted variables file')
from cryptography.fernet import Fernet
import yaml
f = Fernet(open(makepath(programfiles32,'wapt','private','symetric.txt'),'r').read())
variables.update(json.loads(f.decrypt(open(makepath(programfiles32,'wapt','private','variables.txt'),'r').read())))
variables.update(yaml.safe_load(f.decrypt(open(makepath(programfiles32,'wapt','private','variables.txt'),'r').read())))
def install():
parameters = '/S /acceptlicense /server="%s" /execmode=service /runnow' % (','.join(variables['fusinv_servers']))
@ -29,19 +29,17 @@ def install():
def update_package():
import BeautifulSoup,requests,re
import BeautifulSoup,re
from waptpackage import PackageEntry
verify=True
pe = PackageEntry()
pe.load_control_from_wapt(os.getcwd())
current_version = pe['version'].split('-',1)[0]
verify=True
url = 'https://github.com/fusioninventory/fusioninventory-agent/releases'
import requests,BeautifulSoup
page = requests.get(url + '/latest',headers={'User-Agent':'Mozilla/5.0 (Windows NT 6.1; Win64; x64)'},verify=verify).text
page = wgets(url + '/latest')
bs = BeautifulSoup.BeautifulSoup(page)
bs_raw_string = str(bs.find('span',{'class':'css-truncate-target'}).text)