Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion Providers/Scripts/2.4x-2.5x/Scripts/nxAvailableUpdates.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import fnmatch
import time
import os
import uuid

protocol = imp.load_source('protocol', '../protocol.py')
nxDSCLog = imp.load_source('nxDSCLog', '../nxDSCLog.py')
Expand Down Expand Up @@ -71,9 +72,11 @@ def GetAptUpdates(Name):

updates_list = []
d = {}
g_guid = str(uuid.uuid4())
#Collect Security updates
security_sources_list = '/tmp/az-update-security.list'
security_sources_list = '/tmp/aumv1-oms-assess-security-{0}.list'.format(g_guid)
prep_security_sources_list_cmd = 'grep security /etc/apt/sources.list > ' + security_sources_list
remove_security_sources_list_cmd = 'rm ' + '/tmp/aumv1-oms-assess-security-*.list' #to remove all files, following this pattern
dist_upgrade_simulation_cmd_template = 'LANG=en_US.UTF8 apt-get -s dist-upgrade <SOURCES> '
# Refresh the repo
if helperlib.CONFIG_SYSCONFDIR_DSC == "omsconfig":
Expand Down Expand Up @@ -112,6 +115,10 @@ def GetAptUpdates(Name):
d['Classification'] = "Others"
d['Repository'] = pkg[2]
updates_list.append(copy.deepcopy(d))

code, out = RunGetOutput(remove_security_sources_list_cmd,False,False)
if code != 0:
LG().Log('DEBUG', out)
LG().Log('DEBUG', "Number of packages being written to the XML: " + str(len(updates_list)))
return updates_list

Expand Down
11 changes: 8 additions & 3 deletions Providers/Scripts/2.6x-2.7x/Scripts/nxAvailableUpdates.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import fnmatch
import time
import os
import uuid

protocol = imp.load_source('protocol', '../protocol.py')
nxDSCLog = imp.load_source('nxDSCLog', '../nxDSCLog.py')
Expand Down Expand Up @@ -71,9 +72,11 @@ def GetAptUpdates(Name):

updates_list = []
d = {}
g_guid = str(uuid.uuid4())
#Collect Security updates
security_sources_list = '/tmp/az-update-security.list'
security_sources_list = '/tmp/aumv1-oms-assess-security-{0}.list'.format(g_guid)
prep_security_sources_list_cmd = 'grep security /etc/apt/sources.list > ' + security_sources_list
remove_security_sources_list_cmd = 'rm ' + '/tmp/aumv1-oms-assess-security-*.list' #to remove all files, following this pattern
dist_upgrade_simulation_cmd_template = 'LANG=en_US.UTF8 apt-get -s dist-upgrade <SOURCES> '
# Refresh the repo
if helperlib.CONFIG_SYSCONFDIR_DSC == "omsconfig":
Expand Down Expand Up @@ -112,10 +115,13 @@ def GetAptUpdates(Name):
d['Classification'] = "Others"
d['Repository'] = pkg[2]
updates_list.append(copy.deepcopy(d))

code, out = RunGetOutput(remove_security_sources_list_cmd,False,False)
if code != 0:
LG().Log('DEBUG', out)
LG().Log('DEBUG', "Number of packages being written to the XML: " + str(len(updates_list)))
return updates_list


def GetYumUpdates(Name):
# Format:
# Name : zsh
Expand Down Expand Up @@ -193,7 +199,6 @@ def GetYumUpdates(Name):

if len(param_list) == 0 and len(param_list2) > 0:
LG().Log('DEBUG', "No valid packages found. Falling back to package_info based on the package name.")
param_list = param_list2

cmd = "LANG=en_US.UTF8 " + yum_info + param_list
LG().Log('DEBUG', "Retrieving individual package information from Yum using cmd: " + cmd)
Expand Down
12 changes: 9 additions & 3 deletions Providers/Scripts/3.x/Scripts/nxAvailableUpdates.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import fnmatch
import time
import os
import uuid

protocol = imp.load_source('protocol', '../protocol.py')
nxDSCLog = imp.load_source('nxDSCLog', '../nxDSCLog.py')
Expand Down Expand Up @@ -69,9 +70,11 @@ def GetAptUpdates(Name):

updates_list = []
d = {}
g_guid = str(uuid.uuid4())
#Collect Security updates
security_sources_list = '/tmp/az-update-security.list'
security_sources_list = '/tmp/aumv1-oms-assess-security-{0}.list'.format(g_guid)
prep_security_sources_list_cmd = 'grep security /etc/apt/sources.list > ' + security_sources_list
remove_security_sources_list_cmd = 'rm ' + '/tmp/aumv1-oms-assess-security-*.list' #to remove all files, following this pattern
dist_upgrade_simulation_cmd_template = 'LANG=en_US.UTF8 apt-get -s dist-upgrade <SOURCES> '
# Refresh the repo
if helperlib.CONFIG_SYSCONFDIR_DSC == "omsconfig":
Expand Down Expand Up @@ -110,6 +113,10 @@ def GetAptUpdates(Name):
d['Classification'] = "Others"
d['Repository'] = pkg[2]
updates_list.append(copy.deepcopy(d))

code, out = RunGetOutput(remove_security_sources_list_cmd,False,False)
if code != 0:
LG().Log('DEBUG', out)
LG().Log('DEBUG', "Number of packages being written to the XML: " + str(len(updates_list)))
return updates_list

Expand Down Expand Up @@ -191,7 +198,6 @@ def GetYumUpdates(Name):

if len(param_list) == 0 and len(param_list2) > 0:
LG().Log('DEBUG', "No valid packages found. Falling back to package_info based on the package name.")
param_list = param_list2

cmd = "LANG=en_US.UTF8 " + yum_info + param_list
LG().Log('DEBUG', "Retrieving individual package information from Yum using cmd: " + cmd)
Expand Down Expand Up @@ -467,4 +473,4 @@ def GetPackageManager():
if ret == 'apt-get':
ret = 'apt'
break
return ret
return ret