fledge-version added in support bundle file
""" Provides utility functions to build a Fledge Support bundle.
"""
+import logging
import datetime
import platform
import os
@@ -32,7 +33,7 @@ __copyright__ = "Copyright (c) 2017 OSIsoft, LLC"
__license__ = "Apache 2.0"
__version__ = "${VERSION}"
-_LOGGER = logger.setup(__name__)
+_LOGGER = logger.setup(__name__, level=logging.INFO)
_NO_OF_FILES_TO_RETAIN = 3
_SYSLOG_FILE = '/var/log/syslog'
_PATH = _FLEDGE_DATA if _FLEDGE_DATA else _FLEDGE_ROOT + '/data'
@@ -68,6 +69,7 @@ class SupportBuilder:
tar_file_name = self._out_file_path+"/"+"support-{}.tar.gz".format(file_spec)
pyz = tarfile.open(tar_file_name, "w:gz")
try:
+ await self.add_fledge_version(pyz)
self.add_syslog_fledge(pyz, file_spec)
self.add_syslog_storage(pyz, file_spec)
cf_mgr = ConfigurationManager(self._storage)
@@ -128,6 +130,11 @@ class SupportBuilder:
json.dump(data, outfile, indent=4)
pyz.add(temp_file, arcname=basename(temp_file))
+ async def add_fledge_version(self, pyz):
+ temp_file = self._interim_file_path + "/" + "fledge-version"
+ data = await self._storage.query_tbl("version")
+ self.write_to_tar(pyz, temp_file, int(data['rows'][0]['id']))
+
def add_syslog_fledge(self, pyz, file_spec):
# The fledge entries from the syslog file
temp_file = self._interim_file_path + "/" + "syslog-{}".format(file_spec)
