$ upd install -G -c sam or $ upd install -G -c sam_config
If you are upgrading from an existing sam_config installation, you will also need to invoke the command
$ ups sync sam_configThe sam_config product uses the sam_ns_ior product (module sam_ns_ior in the CVS repository) to obtain the underlying symbolic references to the various naming service IOR's.
$ ups tailor sam_config What would you like to do? [a: add configuration] [e: edit configuration] [r: remove configuration] [s: set default configuration] [d: done (default)] $Note that if there are no existing SAM configurations, the only allowed action is adding a new one. All individual actions are described in more detail below.
$ ups list -acK+ sam_config
"sam_config" "v7_1_0" "NULL" "" "current"
$ ups add sam_config
Adding configuration...
Enter choice for the base configuration:
[1: CDF Development (__cdf_dev__)]
[2: CDF Development DB Server (__cdf_db_server_dev__)]
[3: CDF Development Station Server (__cdf_station_server_dev__)]
[4: CDF Development User (__cdf_user_dev__)]
[5: D0 Development (__d0_dev__)]
[6: D0 Development DB Server (__d0_db_server_dev__)]
[7: D0 Development Station Server (__d0_station_server_dev__)]
[8: D0 Development User (__d0_user_dev__)]
[9: D0 Integration (__d0_int__)]
[10: D0 Integration DB Server (__d0_db_server_int__)]
[11: D0 Integration Station Server (__d0_station_server_int__)]
[12: D0 Integration User (__d0_user_int__)]
[13: D0 Production (__d0_prd__)]
[14: D0 Production DB Server (__d0_db_server_prd__)]
[15: D0 Production Station Server (__d0_station_server_prd__)]
[16: D0 Production User (__d0_user_prd__)]
[17: abort action (default)]
16
You have chosen "D0 Production User (__d0_user_prd__)" as your base configuration.
Enter new configuration qualifier:
prd
Enter new configuration description:
New D0 User
Adding configuration prd based on configuration __d0_user_prd__...
Added configuration prd.
Declaring sam_config with qualifier prd into the UPS database...
Executing: ups declare -r /usr/local/ups/prd/sam_config/v7_1_0/NULL \
-M /usr/local/ups/db/sam_config/v7_1_0 -m sam_config_prd.table \
sam_config v7_1_0 -q prd -f NULL -c
$ ups list -acK+ sam_config
"sam_config" "v7_1_0" "NULL" "" "current"
"sam_config" "v7_1_0" "NULL" "prd" "current"
$
SAM_CONFIG_CONFIGS_FROM_ENV="d0_dev|cdf_dev|d0_prd|cdf_prd"it will declare sam_config to the ups db with the qualifiers d0_dev, cdf_dev, ..., based on the base configurations files at conf/__d0_dev__.env, conf/__cdf_dev__.env, ...
Qualifier1:BaseQualifier1:Name1|Qualifier2:BaseQualifier2:Name2where
$ ups list -acK+ sam_config
"sam_config" "v7_1_0" "NULL" "" "current"
"sam_config" "v7_1_0" "NULL" "prd" "current"
$ ups edit sam_config
Modifying configuration...
Enter choice for the existing configuration:
[1: New D0 User (prd)]
[2: abort action (default)]
1
You have chosen "New D0 User (prd)" configuration.
Modifying configuration prd...
Current configuration:
[1: FNORB_NAMING_SERVICE=${SAM_D0_PRD_NS_IOR}
[2: SAM_NAMING_SERVICE_IOR=${SAM_D0_PRD_NS_IOR}
[3: SAM_DB_SERVER_NAME=SAMDbServer.user_prd:SAMDbServer]
[4: SAM_NAMING_SERVICE=d0db.fnal.gov:9010]
[5: SAM_LOG_SERVER_ADDR=d0db.fnal.gov:40583]
What would you like to do?
[a: add variable]
[e: edit variable]
[q: quit]
[r: remove variable]
[d: done (default)]
a
Enter variable to add:
NEW_USER_VARIABLE
Enter value for NEW_USER_VARIABLE:
value_of_the_new_user_variable
Current configuration:
[1: FNORB_NAMING_SERVICE=${SAM_D0_PRD_NS_IOR}
[2: NEW_USER_VARIABLE=value_of_the_new_user_variable]
[3: SAM_NAMING_SERVICE_IOR=${SAM_D0_PRD_NS_IOR}
[4: SAM_DB_SERVER_NAME=SAMDbServer.user_prd:SAMDbServer]
[5: SAM_NAMING_SERVICE=d0db.fnal.gov:9010]
[6: SAM_LOG_SERVER_ADDR=d0db.fnal.gov:40583]
What would you like to do?
[a: add variable]
[e: edit variable]
[q: quit]
[r: remove variable]
[d: done (default)]
Are you sure that you want to keep these changes?
[n: no]
[y: yes (default)]
Modified configuration prd.
Undeclaring sam_config with qualifier prd from the UPS database...
Executing: ups undeclare sam_config `ups list -acK version \
sam_config -q prd -f NULL | sed 's/"//g'` -q prd -f NULL
Declaring sam_config with qualifier prd into the UPS database...
Executing: ups declare -r /usr/local/ups/prd/sam_config/v7_1_0/NULL \
-M /usr/local/ups/db/sam_config/v7_1_0 -m sam_config_prd.table \
sam_config v7_1_0 -q prd -f NULL -c
$ ups list -acK+ sam_config
"sam_config" "v7_1_0" "NULL" "" "current"
"sam_config" "v7_1_0" "NULL" "prd" "current"
$
Note that SAM Config keeps track of the history of changes that are
made to SAM configurations.
$ ups list -acK+ sam_config "sam_config" "v7_1_0" "NULL" "" "current" "sam_config" "v7_1_0" "NULL" "prd" "current" $ ups inquire sam_config EXISTING_CONFIGURATION=New D0 User|prd|prd.env $In the above output, the first field is a configuration description, the second one is its qualifier, and the last one is a text file containing all of the environment variables this particular configuration is using.
Note that one can also inquire on an existing configuration and obtain the list of all environment variables that particular configuration is using:
$ ups inquire sam_config -q prd
SAM_CONFIGURATION_NAME=New D0 User
SAM_CONFIGURATION_FILE=prd.env
SAM_CONFIGURATION_QUALIFIER=prd
SAM_NAMING_SERVICE=d0db.fnal.gov:9010
NEW_USER_VARIABLE=value_of_the_new_user_variable
SAM_NAMING_SERVICE_IOR=${SAM_D0_PRD_NS_IOR}
SAM_DB_SERVER_NAME=SAMDbServer.user_prd:SAMDbServer
FNORB_NAMING_SERVICE=${SAM_D0_PRD_NS_IOR}
SAM_LOG_SERVER_ADDR=d0db.fnal.gov:40583
$
$ ups list -acK+ sam_config "sam_config" "v7_1_0" "NULL" "" "current" "sam_config" "v7_1_0" "NULL" "prd" "current" $ setup sam_config No SAM configuration has been set as default at this time. $ ups setdefault sam_config Setting default configuration... Enter choice for the existing configuration: [1: New D0 User (prd)] [2: abort action (default)] 1 You have chosen "New D0 User (prd)" configuration. Setting configuration prd as default... Set configuration prd as default. $ ups inquire sam_config DEFAULT_CONFIGURATION=New D0 User|prd|prd.env EXISTING_CONFIGURATION=New D0 User|prd|prd.env $ echo $NEW_USER_VARIABLE NEW_USER_VARIABLE: Undefined variable. $ setup sam_config $ echo $NEW_USER_VARIABLE value_of_the_new_user_variable $
$ ups list -acK+ sam_config
"sam_config" "v7_1_0" "NULL" "" "current"
"sam_config" "v7_1_0" "NULL" "prd" "current"
$ ups delete sam_config
Deleting configuration...
Enter choice for the existing configuration:
[1: New D0 User (prd)]
[2: abort action (default)]
1
You have chosen "New D0 User (prd)" configuration.
Deleting configuration prd...
Deleted configuration prd.
Undeclaring sam_config with qualifier prd from the UPS database...
Executing: ups undeclare sam_config `ups list -acK version sam_config \
-q prd -f NULL | sed 's/"//g'` -q prd -f NULL
$ ups list -acK+ sam_config
"sam_config" "v7_1_0" "NULL" "" "current"
$ ups inquire sam_config
No SAM configurations exist at this time.
$
$ ups list -acK+ sam_config
"sam_config" "v7_1_0" "NULL" "" "current"
"sam_config" "v7_1_0" "NULL" "prd" "current"
$ upd install -G-c sam_config v7_1_1
Creating version link in /usr/local/ups/db/sam_config/Symlinks for sam_config v7_1_1.
Creating current link in /usr/local/ups/db/sam_config/Symlinks for sam_config v7_1_1.
informational: installed sam_config v7_1_1.
upd install succeeded.
$ ups list -acK+ sam_config
"sam_config" "v7_1_0" "NULL" "prd" "current"
"sam_config" "v7_1_1" "NULL" "" "current"
$ ups sync sam_config
Regenerating table file for qualifier 'prd'...
Executing: ups declare -r /usr/local/ups/prd/sam_config/v7_1_1/NULL \
-M /usr/local/ups/db/sam_config/v7_1_1 -m sam_config_prd.table \
sam_config v7_1_1 -q prd -f NULL -c
$ ups list -acK+ sam_config
"sam_config" "v7_1_0" "NULL" "" ""
"sam_config" "v7_1_1" "NULL" "" "current"
"sam_config" "v7_1_1" "NULL" "prd" "current"
$
Note that SAM Config (i.e., its ConfigurationManager class) manages its configurations independently of UPS. Interoperability with UPS (i.e., all of the above described commands) is provided via the specialized UPSConfigurationManager class.
PREDEFINED_CONFIGURATION=New Cfg Description|__new_cfg__|__new_cfg__.envAs mentioned above, the meaning of the above columns are new configuration description, its qualifier, and file with its environment variables, respectively.