mirror of
https://github.com/GAM-team/GAM.git
synced 2026-07-03 20:31:35 +00:00
Add gam version checkrc (#1605)
* Add gam version checkrc * Fix code * gam version checkrc cleanup
This commit is contained in:
@@ -873,7 +873,7 @@ Specify a collection of Users by directly specifying them or by specifying items
|
|||||||
<UserMultiAttribute>
|
<UserMultiAttribute>
|
||||||
|
|
||||||
gam checkconnection
|
gam checkconnection
|
||||||
gam version [check|simple|extended] [timeoffset] [location <HostName>]
|
gam version [check|checkrc|simple|extended] [timeoffset] [location <HostName>]
|
||||||
gam help
|
gam help
|
||||||
|
|
||||||
gam batch <FileName>|- [charset <Charset>]
|
gam batch <FileName>|- [charset <Charset>]
|
||||||
|
|||||||
@@ -589,7 +589,7 @@ def SetGlobalVariables():
|
|||||||
GM_Globals[GM_ENABLEDASA_TXT] = os.path.join(
|
GM_Globals[GM_ENABLEDASA_TXT] = os.path.join(
|
||||||
GC_Values[GC_CONFIG_DIR], FN_ENABLEDASA_TXT)
|
GC_Values[GC_CONFIG_DIR], FN_ENABLEDASA_TXT)
|
||||||
if not GC_Values[GC_NO_UPDATE_CHECK]:
|
if not GC_Values[GC_NO_UPDATE_CHECK]:
|
||||||
doGAMCheckForUpdates()
|
doGAMCheckForUpdates(forceCheck=0)
|
||||||
|
|
||||||
# domain must be set and customer_id must be set and != my_customer when enable_dasa = true
|
# domain must be set and customer_id must be set and != my_customer when enable_dasa = true
|
||||||
if GC_Values[GC_ENABLE_DASA]:
|
if GC_Values[GC_ENABLE_DASA]:
|
||||||
@@ -660,7 +660,7 @@ def getLocalGoogleTimeOffset(testLocation='admin.googleapis.com'):
|
|||||||
return (offset, nicetime)
|
return (offset, nicetime)
|
||||||
|
|
||||||
|
|
||||||
def doGAMCheckForUpdates(forceCheck=False):
|
def doGAMCheckForUpdates(forceCheck=0):
|
||||||
|
|
||||||
def _gamLatestVersionNotAvailable():
|
def _gamLatestVersionNotAvailable():
|
||||||
if forceCheck:
|
if forceCheck:
|
||||||
@@ -703,6 +703,8 @@ def doGAMCheckForUpdates(forceCheck=False):
|
|||||||
print(
|
print(
|
||||||
f'Version Check:\n Current: {current_version}\n Latest: {latest_version}'
|
f'Version Check:\n Current: {current_version}\n Latest: {latest_version}'
|
||||||
)
|
)
|
||||||
|
if forceCheck < 0:
|
||||||
|
sys.exit(1 if latest_version > current_version else 0)
|
||||||
if latest_version <= current_version:
|
if latest_version <= current_version:
|
||||||
fileutils.write_file(GM_Globals[GM_LAST_UPDATE_CHECK_TXT],
|
fileutils.write_file(GM_Globals[GM_LAST_UPDATE_CHECK_TXT],
|
||||||
str(now_time),
|
str(now_time),
|
||||||
@@ -822,14 +824,18 @@ def checkConnection():
|
|||||||
controlflow.system_error_exit(3, createYellowText('Some hosts failed to connect! Please follow the recommendations for those hosts to correct any issues and try again.'))
|
controlflow.system_error_exit(3, createYellowText('Some hosts failed to connect! Please follow the recommendations for those hosts to correct any issues and try again.'))
|
||||||
|
|
||||||
def doGAMVersion(checkForArgs=True):
|
def doGAMVersion(checkForArgs=True):
|
||||||
force_check = extended = simple = timeOffset = False
|
forceCheck = 0
|
||||||
|
extended = simple = timeOffset = False
|
||||||
testLocation = 'admin.googleapis.com'
|
testLocation = 'admin.googleapis.com'
|
||||||
if checkForArgs:
|
if checkForArgs:
|
||||||
i = 2
|
i = 2
|
||||||
while i < len(sys.argv):
|
while i < len(sys.argv):
|
||||||
myarg = sys.argv[i].lower().replace('_', '')
|
myarg = sys.argv[i].lower().replace('_', '')
|
||||||
if myarg == 'check':
|
if myarg == 'check':
|
||||||
force_check = True
|
forceCheck = 1
|
||||||
|
i += 1
|
||||||
|
elif myarg == 'checkrc':
|
||||||
|
forceCheck = -1
|
||||||
i += 1
|
i += 1
|
||||||
elif myarg == 'simple':
|
elif myarg == 'simple':
|
||||||
simple = True
|
simple = True
|
||||||
@@ -869,8 +875,8 @@ def doGAMVersion(checkForArgs=True):
|
|||||||
(testLocation, nicetime))
|
(testLocation, nicetime))
|
||||||
if offset > MAX_LOCAL_GOOGLE_TIME_OFFSET:
|
if offset > MAX_LOCAL_GOOGLE_TIME_OFFSET:
|
||||||
controlflow.system_error_exit(4, 'Please fix your system time.')
|
controlflow.system_error_exit(4, 'Please fix your system time.')
|
||||||
if force_check:
|
if forceCheck:
|
||||||
doGAMCheckForUpdates(forceCheck=True)
|
doGAMCheckForUpdates(forceCheck)
|
||||||
if extended:
|
if extended:
|
||||||
print(ssl.OPENSSL_VERSION)
|
print(ssl.OPENSSL_VERSION)
|
||||||
libs = ['cryptography',
|
libs = ['cryptography',
|
||||||
|
|||||||
Reference in New Issue
Block a user