Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
enabled_list = None
if plugins_result.plugin:
for host2 in plugins_result.plugin:
if host2.host == host.host:
enabled_list = host2.list
if not enabled_list:
page_messages.append({'status':'warning', 'msg':'No plugin enabled'})
# Generate the installed package list
if type in host.installed:
host.installed.packages = host.installed[type]
for package in host.installed.packages:
installed[package.name] = package
try:
installed[package.name]['NormalizedVersion'] = NormalizedVersion(package.release)
except IrrationalVersionError:
package.installed_version_error = True
installed[package.name]['NormalizedVersion'] = None
#find enabled plugins
if type == 'plugin' and enabled_list:
for plugin in enabled_list:
if (plugin.name == package.name):
package.enabled = True
host.available = []
if (packages_result.package) :
for package in packages_result.package[0][type]:
package_min_version = NormalizedVersion(suggest_normalized_version(package.domogik_min_release))
try:
package_version = NormalizedVersion(package.release)
package.version_error = False
except IrrationalVersionError:
def get_info_extended(self):
_data = self.get_info()
if (_data):
if ("REST_API_version" in _data.info):
_data.info['rinor_version'] = _data.info.REST_API_version
else:
_data.info['rinor_version'] = '0.1'
if ("Domogik_version" in _data.info):
_data.info['dmg_version'] = _data.info.Domogik_version
else:
_data.info['dmg_version'] = '0.1'
try:
_data.info['rinor_version_superior'] = (NormalizedVersion(_data.info['rinor_version']) > NormalizedVersion(settings.RINOR_MAX_API))
except IrrationalVersionError:
_data.info['rinor_version_superior'] = False
try:
_data.info['rinor_version_inferior'] = (NormalizedVersion(_data.info['rinor_version']) < NormalizedVersion(settings.RINOR_MIN_API))
except IrrationalVersionError:
_data.info['rinor_version_inferior'] = False
return _data
else:
return None
enabled_list = None
if plugins_result.plugin:
for host2 in plugins_result.plugin:
if host2.host == host.host:
enabled_list = host2.list
if not enabled_list:
page_messages.append({'status':'warning', 'msg':'No plugin enabled'})
# Generate the installed package list
if type in host.installed:
host.installed.packages = host.installed[type]
for package in host.installed.packages:
installed[package.name] = package
try:
installed[package.name]['NormalizedVersion'] = NormalizedVersion(package.release)
except IrrationalVersionError:
package.installed_version_error = True
installed[package.name]['NormalizedVersion'] = None
#find enabled plugins
if type == 'plugin' and enabled_list:
for plugin in enabled_list:
if (plugin.name == package.name):
package.enabled = True
host.available = []
if (packages_result.package) :
for package in packages_result.package[0][type]:
package_min_version = NormalizedVersion(suggest_normalized_version(package.domogik_min_release))
try:
package_version = NormalizedVersion(package.release)
package.version_error = False
except IrrationalVersionError:
def get_info_extended(self):
_data = self.get_info()
if (_data):
if ("REST_API_version" in _data.info):
_data.info['rinor_version'] = _data.info.REST_API_version
else:
_data.info['rinor_version'] = '0.1'
if ("Domogik_version" in _data.info):
_data.info['dmg_version'] = _data.info.Domogik_version
else:
_data.info['dmg_version'] = '0.1'
try:
_data.info['rinor_version_superior'] = (NormalizedVersion(_data.info['rinor_version']) > NormalizedVersion(settings.RINOR_MAX_API))
except IrrationalVersionError:
_data.info['rinor_version_superior'] = False
try:
_data.info['rinor_version_inferior'] = (NormalizedVersion(_data.info['rinor_version']) < NormalizedVersion(settings.RINOR_MIN_API))
except IrrationalVersionError:
_data.info['rinor_version_inferior'] = False
return _data
else:
return None
package.installed_version_error = True
installed[package.name]['NormalizedVersion'] = None
#find enabled plugins
if type == 'plugin' and enabled_list:
for plugin in enabled_list:
if (plugin.name == package.name):
package.enabled = True
host.available = []
if (packages_result.package) :
for package in packages_result.package[0][type]:
package_min_version = NormalizedVersion(suggest_normalized_version(package.domogik_min_release))
try:
package_version = NormalizedVersion(package.release)
package.version_error = False
except IrrationalVersionError:
package.version_error = True
if (dmg_version) :
package.upgrade_require = (package_min_version > dmg_version)
if package.name not in installed:
package.install = True
host.available.append(package)
# Check if update can be done
elif installed[package.name]['NormalizedVersion'] and not package.version_error:
if (installed[package.name]['NormalizedVersion'] < package_version):
installed[package.name]['update_available'] = package_version
package.update = True
host.available.append(package)
elif not installed[package.name]['NormalizedVersion'] and not package.version_error:
installed[package.name]['update_available'] = package_version
package.update = True