Added variables <RESearchPattern> to gam config|select verify

This commit is contained in:
Ross Scroggs
2026-01-12 15:43:03 -08:00
parent 6135e5c2a2
commit ac14037eb3
3 changed files with 31 additions and 6 deletions

View File

@@ -1290,11 +1290,12 @@ Specify a collection of items by directly specifying them; the item type is dete
## Select a section from gam.cfg and process a GAM command using values from that section
<Select> ::=
select <Section> [save] [verify]
select <Section> [save] [verify [variables <RESearchPattern>]]
save
Set section = <Section> in the [DEFAULT] section and write configuration data to gam.cfg
verify
Print the variable values for the selected section
Use `variables <RESearchPattern>` to display variables with names selected by `<RESearchPattern>`
Values are determined in this order: Selected section, DEFAULT section, Program default
## Display all of the sections in gam.cfg and mark the currently selected section with a *.
@@ -1318,7 +1319,7 @@ csv_input_row_drop_filter, csv_input_row_drop_filter_mode and csv_input_row_limi
## Set variables in gam.cfg.
<Config> ::=
config (<VariableName> [=] <Value>)* [save] [verify]
config (<VariableName> [=] <Value>)* [save] [verify [variables <RESearchPattern>]]
<VariableName> [=] <Value>
Set <VariableName> = <Value> in the current section
All <VariableNames> except section are allowed.
@@ -1327,6 +1328,7 @@ save
Write configuration data to gam.cfg
verify
Print the variable values for the current section
Use `variables <RESearchPattern>` to display variables with names selected by `<RESearchPattern>`.
Values are determined in this order: Current section, DEFAULT section, Program default
## Terminate processing of a CSV or batch file when one of the subprocesses returns a matching return code.

View File

@@ -1,3 +1,23 @@
7.31.05
Added option `variables <RESearchPattern>` to `gam select section <SectionName> verify` and `gam config verify`
that causes GAM to only display variables with names selected by `<RESearchPattern>`.
```
gam select School verify variables "^(customer|domain)"
Section: School
customer_id = C03abc123
domain = school.edu
gam config verify variables 'dir'
Section: DEFAULT
cache_dir = ~/GamConfig/gamcache ; /Users/gamteam/GamConfig/gamcache
config_dir = ~/GamConfig ; /Users/gamteam/GamConfig
drive_dir = ~/GamWork ; /Users/gamteam/GamWork
gmail_cse_incert_dir = ~/GmailCSE/Certs ; /Users/gamteam/GmailCSE/Certs
gmail_cse_inkey_dir = ~/GmailCSE/Keys ; /Users/gamteam/GmailCSE/Keys
input_dir = .
```
7.31.04
Fixed bug in `gam report admin|chrome` that caused to events to not be displayed.

View File

@@ -3,7 +3,7 @@
#
# GAM7
#
# Copyright 2025, All Rights Reserved.
# Copyright 2026, All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -25,7 +25,7 @@ https://github.com/GAM-team/GAM/wiki
"""
__author__ = 'GAM Team <google-apps-manager@googlegroups.com>'
__version__ = '7.31.04'
__version__ = '7.31.05'
__license__ = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)'
#pylint: disable=wrong-import-position
@@ -3831,9 +3831,12 @@ def SetGlobalVariables():
stderrErrorMsg(fileErrorMessage(fileName, e, Ent.CONFIG_FILE))
def _verifyValues(sectionName, inputFilterSectionName, outputFilterSectionName):
itemNamePattern = getREPattern() if checkArgumentPresent('variables') else None
printKeyValueList([Ent.Singular(Ent.SECTION), sectionName]) # Do not use printEntity
Ind.Increment()
for itemName, itemEntry in GC.VAR_INFO.items():
if itemNamePattern and not itemNamePattern.search(itemName):
continue
sectName = sectionName
if itemName in GC.CSV_INPUT_ROW_FILTER_ITEMS:
if inputFilterSectionName:
@@ -4014,7 +4017,7 @@ def SetGlobalVariables():
usageErrorExit(formatKeyValueList('', [EV_GAMCFGSECTION, sectionName, 'select', Msg.NOT_ALLOWED], ''))
else:
sectionName = _getCfgSection(configparser.DEFAULTSECT, GC.SECTION)
# select <SectionName> [save] [verify]
# select <SectionName> [save] [verify [variables <RESearchPattern>]]
if checkArgumentPresent(Cmd.SELECT_CMD):
sectionName = _selectSection()
GM.Globals[GM.SECTION] = sectionName # Save section for inner gams
@@ -4065,7 +4068,7 @@ def SetGlobalVariables():
if GM.Globals[GM.PARSER].has_option(section, GC.CMDLOG_MAX__BACKUPS):
GM.Globals[GM.PARSER].set(section, GC.CMDLOG_MAX_BACKUPS, GM.Globals[GM.PARSER].get(section, GC.CMDLOG_MAX__BACKUPS))
GM.Globals[GM.PARSER].remove_option(section, GC.CMDLOG_MAX__BACKUPS)
# config (<VariableName> [=] <Value>)* [save] [verify]
# config (<VariableName> [=] <Value>)* [save] [verify [variables <RESearchPattern>]]
if checkArgumentPresent(Cmd.CONFIG_CMD):
while Cmd.ArgumentsRemaining():
if checkArgumentPresent('save'):