Skip to content

Commit

Permalink
Rename asum to sum (#6)
Browse files Browse the repository at this point in the history
* Rename asum.go to sum.go

* Update ASUM to sum.

* Update format
  • Loading branch information
abhijithda authored Jun 26, 2021
1 parent 88a8bd5 commit 46aaefc
Show file tree
Hide file tree
Showing 17 changed files with 64 additions and 64 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ GOTOOLSBIN=$(TOP)/tools/go/

# SUM SDK related variables
SDK_NAME = sum-sdk
# Keep the SDK_VERSION same as ASUM_RPM_FORMAT_VERSION.
# Keep the SDK_VERSION same as RPM_FORMAT_VERSION.
SDK_VERSION = 2.0
SDK_REVERSION = 1
SDK_SOURCE_PATH = $(TOP)/sdk
Expand Down
8 changes: 4 additions & 4 deletions cmd/asum/asum.go → cmd/sum/sum.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var (
// progname is name of my binary/program/executable.
progname = filepath.Base(os.Args[0])
// version of my program.
version = "5.8"
version = "5.9"
)

func mainRegisterCmdOptions() {
Expand All @@ -35,7 +35,7 @@ var mainCmdOptions struct {
}

func init() {
config.SetLogDir("/var/log/asum/")
config.SetLogDir("/var/log/sum/")
}

func main() {
Expand Down Expand Up @@ -118,7 +118,7 @@ func usage(progname, subcmd string) {
switch subcmd {
case "":
const usageStr = `
SUM (PROGNAME) is a tool for Software Updates Management (ASUM).
SUM (PROGNAME) is a tool for Software Updates Management (SUM).
Usage:
Expand All @@ -132,7 +132,7 @@ The commands are:
reboot reboots/restarts the node running reboots specific action for installing software update.
repo perform Software Repository management operations.
rollback rolls back the installed software update.
version print Software Updates Management (ASUM) version.
version print Software Updates Management (SUM) version.
Use "PROGNAME help [command]" for more information about a command.
Expand Down
4 changes: 2 additions & 2 deletions repo/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import (
"gopkg.in/yaml.v2"
)

// FormatVersionName is the ASUM RPM format version string that's embedded
// FormatVersionName is the RPM format version string that's embedded
// into RPM used for identifying the JSON format version.
const FormatVersionName = "ASUM RPM Format Version"
const FormatVersionName = "RPM Format Version"

// RPMInfo is the list of RPM package info
type RPMInfo interface {
Expand Down
2 changes: 1 addition & 1 deletion repo/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func registerCommandVersion(progname string) {
// Input:
// 1. map[string]interface{}
// where, the options could be following:
// "progname": Name of the program along with any cmds (ex: asum pm)
// "progname": Name of the program along with any cmds (ex: sum pm)
// "cmd-index": Index to the cmd (ex: run)
func ScanCommandOptions(options map[string]interface{}) error {
log.Printf("Entering ScanCommandOptions(%+v)...", options)
Expand Down
4 changes: 2 additions & 2 deletions sample/update/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ all: update

.PHONY: update
update:
@echo "======== Generating update RPM using ASUM SDK..."; \
@echo "======== Generating update RPM using SUM SDK..."; \
$(MAKE) -C $(SUM_SDK_PATH) generate \
PLUGINS_LIBRARY=$(TOP)/library/ \
RPM_NAME=$(UPDATE_RPM_NAME) \
RPM_VERSION=$(UPDATE_VERSION) \
RPM_RELEASE=$(UPDATE_RELEASE) \
RPM_URL=$(UPDATE_URL) \
RPM_SUMMARY="Sample Update RPM created using ASUM SDK" \
RPM_SUMMARY="Sample Update RPM created using SUM SDK" \
RPM_INFO_FILE=$(UPDATE_RPM_INFO_FILE) || exit $$?


Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright (c) 2020 Veritas Technologies LLC. All rights reserved. IP63-2828-7171-04-15-9
# Copyright (c) 2021 Veritas Technologies LLC. All rights reserved. IP63-2828-7171-04-15-9
Description=Preparing for reboot
# NOTE: Call `asum reboot` as the last step in `install` step to automatically
# NOTE: Call `sum reboot` as the last step in `install` step to automatically
# invoke (pre)reboot actions.
ExecStart=${PM_LIBRARY}/../asum reboot
ExecStart=${PM_LIBRARY}/../sum reboot
3 changes: 1 addition & 2 deletions sdk/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
asum
pm
sum
26 changes: 13 additions & 13 deletions sdk/Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Copyright (c) 2021 Veritas Technologies LLC. All rights reserved IP63-2828-7171-04-15-9.

# ASUM_RPM_FORMAT_VERSION is like a protocol version.
# This will be used by the ASUM binary to list the contents appropriately.
# RPM_FORMAT_VERSION is like a protocol version.
# This will be used by the SUM binary to list the contents appropriately.
# This version needs to be updated, only if there is format/layout changes
# that breaks backward compatibility w.r.t. parsing RPM info by the `asum`
# that breaks backward compatibility w.r.t. parsing RPM info by the `sum`
# binary.
ASUM_RPM_FORMAT_VERSION=2
RPM_FORMAT_VERSION=2

# Jenking build options
PRODUCT?=asum
PRODUCT?=sum
VERSION?=1.0
BRANCH?=main

Expand All @@ -32,8 +32,8 @@ PLUGINS_LIBRARY?=$(PACKAGE_DIR)/library
PLUGIN_TYPES?="preinstall install prereboot postreboot rollback-precheck prerollback rollback commit-precheck commit"

RPM_PRE_SCRIPT?=$(RPM_SCRIPTS_DIR)/rpm_pre.sh
RPM_SPEC_FILE=asumrpm.spec
RPM_INST_FILE=asumrpm.inst
RPM_SPEC_FILE=sumrpm.spec
RPM_INST_FILE=sumrpm.inst

TARGET_DIR=system/upgrade/repository/update/$(RPM_NAME)-$(RPM_VERSION)-$(RPM_RELEASE)

Expand All @@ -50,7 +50,7 @@ all: generate
# required for updating the system.
.PHONY: generate
generate:
@echo ===== Generating ASUM RPM =====
@echo ===== Generating SUM RPM =====
@echo Creating spec and inst files.
if [ ! -f $(RPM_INFO_FILE) ] ; then \
echo "RPM Info JSON file does not exist at $(RPM_INFO_FILE)." ; \
Expand All @@ -76,7 +76,7 @@ generate:
-e "s%__VERSION__%$(RPM_VERSION)%g" \
-e "s|__RELEASE__|$(RPM_RELEASE)|g" \
-e "s%__URL__%$(RPM_URL)%g" \
-e "s%__ASUM_RPM_FORMAT_VERSION__%$(ASUM_RPM_FORMAT_VERSION)%g" \
-e "s%__RPM_FORMAT_VERSION__%$(RPM_FORMAT_VERSION)%g" \
-e "s%__RPM_INFO__%$${rpm_desc}%g" \
$(PACKAGE_DIR)/SPECS/$(RPM_SPEC_FILE);

Expand All @@ -95,7 +95,7 @@ generate:
7z x $(ISO_PATH) -o$(PLUGINS_LIBRARY)/$${iso_target_dir}/ -y; \
fi ; \

@echo ======== Adding ASUM scripts and plugins for version $(RPM_VERSION) for RPM packaging.
@echo ======== Adding SUM scripts and plugins for version $(RPM_VERSION) for RPM packaging.
cp -v ${RPM_SCRIPTS_DIR}/* $(PACKAGE_DIR)/$(TARGET_DIR)
cp -Rv $(PLUGINS_LIBRARY) $(PACKAGE_DIR)/$(TARGET_DIR)

Expand All @@ -105,7 +105,7 @@ generate:
pluginTypes=$(PLUGIN_TYPES); \
for pt in $${pluginTypes}; do \
echo "Generating image for $${pt}..."; \
$(TOP)/scripts/asum pm list -library $(PLUGINS_LIBRARY) -type $${pt} -log-dir $(PLUGINS_LIBRARY)/../imgs/ -log-file $${pt}; \
$(TOP)/scripts/sum pm list -library $(PLUGINS_LIBRARY) -type $${pt} -log-dir $(PLUGINS_LIBRARY)/../imgs/ -log-file $${pt}; \
done;

@echo ======== Keeping only plugin graph images and cleaning logs in image dir.
Expand Down Expand Up @@ -135,7 +135,7 @@ generate:
done; \
git add $${readme} $(PLUGINS_LIBRARY)/../imgs/*.svg;

@echo ======== Calling mkrpm.sh utility to generate the ASUM RPM.
@echo ======== Calling mkrpm.sh utility to generate the SUM RPM.
cd $(PACKAGE_DIR); \
if [ -n "$(SHIP_DIR)" ]; then \
export PLATFORM_RPM_LOCATION=$(SHIP_DIR); \
Expand All @@ -145,7 +145,7 @@ generate:

.PHONY: clean
clean:
@echo ======== Removing ASUM RPM artifacts.
@echo ======== Removing SUM RPM artifacts.
-rm -rf $(PACKAGE_DIR)


Expand Down
11 changes: 6 additions & 5 deletions sdk/README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
# ASUM SDK
# SUM SDK

## Update RPM Generation

An update RPM should be ASUM format compliant in order for one to successfully install the update. In order to generate such an RPM, one should use the [ASUM SDK](../sdk/Makefile) along with providing appropriate [rpm information](./rpm-info.json).
An update RPM should be SUM format compliant in order for one to successfully install the update. In order to generate such an RPM, one should use the [SUM SDK](../sdk/Makefile) along with providing appropriate [rpm information](./rpm-info.json).

### Prerequisites

To use this framework, you need the following:
1. ASUM SDK

1. SUM SDK
2. JSON file containing RPM information. Ex: [rpm-info.json](./rpm-info.json).
3. Library of plugin folders containing plugins.
4. Optionally ISO can be specified through `ISO_PATH` to include ISO contents into the RPM.
NOTE: The ISO contents would be extracted into `$(PLUGINS_LIBRARY)/iso/contents` folder, and appropriate `.install` plugin should be included to install the contents of this ISO to do online or offline upgrade. One can place the required `.install` plugins inside `$(PLUGINS_LIBRARY)/iso` or any other plugin folder, and access the contents of ISO using `$(PLUGINS_LIBRARY)/iso/contents` path.

### Usage

Download and extract the ASUM SDK, and call the `make` target as below by specifying appropriate parameters as shown below:
Download and extract the SUM SDK, and call the `make` target as below by specifying appropriate parameters as shown below:

```bash
$(MAKE) -C $(ASUM_SDK_PATH) generate \
$(MAKE) -C $(SUM_SDK_PATH) generate \
ISO_PATH=$${Path_to_ISO} \
PLUGINS_LIBRARY=$${PluginsLibraryPath} \
RPM_NAME=$${RPM_Name} \
Expand Down
2 changes: 1 addition & 1 deletion sdk/asumrpm.spec
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ BuildArch: x86_64
Packager: Appliance Solutions

%description
ASUM RPM Format Version : __ASUM_RPM_FORMAT_VERSION__
RPM Format Version : __RPM_FORMAT_VERSION__
RPM Info : __RPM_INFO__

%define debug_package %{nil}
Expand Down
2 changes: 1 addition & 1 deletion sdk/scripts/commit
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ myprg=$0
myDir=$(dirname ${myprg})

echo "Committing the update..."
${myDir}/asum commit "$@"
${myDir}/sum commit "$@"
if [ $? -ne 0 ]; then
echo "Error: Failed to commit the update."
exit 1
Expand Down
2 changes: 1 addition & 1 deletion sdk/scripts/install
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ fi
export VXAPP_UPGRADE_ROOT="/system/upgrade/volume/"

echo "Installing the update..."
${myDir}/asum install "$@"
${myDir}/sum install "$@"
if [ $? -ne 0 ]; then
echo "Error: Failed to install the update."
exit 1
Expand Down
2 changes: 1 addition & 1 deletion sdk/scripts/reboot
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ myDir=$(dirname ${myprg})
export VXAPP_UPGRADE_ROOT="/system/upgrade/volume/"

echo "Restarting the node to continue with the update installation..."
${myDir}/asum reboot "$@"
${myDir}/sum reboot "$@"
if [ $? -ne 0 ]; then
echo "Error: Failed to restart the node."
exit 1
Expand Down
4 changes: 2 additions & 2 deletions sdk/scripts/rollback
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ myDir=$(dirname ${myprg})

echo "Rolling back the update..."
# NOTE:
# 1. The rollback plugins would now be called as part of the `asum install`
# 1. The rollback plugins would now be called as part of the `sum install`
# itself.
# 2. This `rollback` script (i.e., ${myprg}) would be called through rollback
# REST API soon to do rollback-precheck, reboot & then rollback. Till
# then, this is just a noop i.e., exit with 0.

${myDir}/asum rollback "$@"
${myDir}/sum rollback "$@"
if [ $? -ne 0 ]; then
echo "Error: Failed to roll back the update."
exit 1
Expand Down
8 changes: 4 additions & 4 deletions update/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ const (
// Status is the execution/run status of PM on a specified plugin type.
type Status struct {
// INFO: The Status contains info of all operations so as to support
// all operations with one call to asum with appropriate flags set to
// all operations with one call to sum with appropriate flags set to
// continue onto the next operation.
// Ex: Install can receive auto-reboot=true, in which after installation
// is completed successfully, `asum` will run reboot operation.
// is completed successfully, `sum` will run reboot operation.
Install []pm.RunStatus `yaml:",omitempty"`
Reboot []pm.RunStatus `yaml:",omitempty"`
Rollback []pm.RunStatus `yaml:",omitempty"`
Expand Down Expand Up @@ -149,7 +149,7 @@ func runCmdFromRPM(action, swName, swType string, params map[string]string) erro
rpmInfo := listInfo[0]

// INFO: Only for `install` action, we need to first install/extract the
// ASUM RPM to get the install script. For all other actions, the
// SUM RPM to get the install script. For all other actions, the
// install script is expected to run first, and hence they're
// expected to be present at the scripts location.
if "install" == action {
Expand Down Expand Up @@ -370,7 +370,7 @@ func RegisterCommandOptions(progname string) {
// Input:
// 1. map[string]interface{}
// where, the options could be following:
// "progname": Name of the program along with any cmds (ex: asum pm)
// "progname": Name of the program along with any cmds (ex: sum pm)
// "cmd-index": Index to the cmd (ex: run)
func ScanCommandOptions(options map[string]interface{}) error {
log.Printf("Entering ScanCommandOptions(%+v)...", options)
Expand Down
2 changes: 1 addition & 1 deletion utils/rpm/rpm.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) 2021 Veritas Technologies LLC. All rights reserved. IP63-2828-7171-04-15-9

// Package rpm contains utility functions (required by ASUM) for managing RPM files.
// Package rpm contains utility functions (required by SUM) for managing RPM files.
package rpm

import (
Expand Down
40 changes: 20 additions & 20 deletions utils/rpm/rpm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,30 +87,30 @@ Packager : Veritas AS DevOps <[email protected]>
URL : https://www.veritas.com/support/en_US.html
Summary : Sample Update RPM created using ASUM SDK
Description :
ASUM RPM Format Version : 2
RPM Format Version : 2
RPM Info : {"Description":["Sample multi-line description of the update RPM.","Client scripts/GUI can display each item in this list in a separate para with appropriate linebreaks."],"Type":"Update","VersionInfo":[{"Version":"*","install":{"confirmation-message":["Sample multi-line confirmation message","","Display info messages and instructions like restarting node, ","and confirming that users have stopped instances."],"requires-restart":true,"supports-rollback":false,"estimated-minutes":35},"rollback":{"confirmation-message":["Sample multi-line confirmation message","","Display info messages and instructions like restarting node, ","and confirming that users have stopped instances."],"requires-restart":true,"estimated-minutes":20},"commit":{"confirmation-message":["Sample multi-line confirmation message","","Display info messages and instructions like once update is committed, you cannot roll back.","Also, committing node restarts some services."],"estimated-minutes":5}},{"Version":"3.*","install":{"confirmation-message":["Sample multi-line confirmation message","","Display warning messages and instructions like stopping instances."],"requires-restart":false,"supports-rollback":false,"estimated-minutes":25},"rollback":{"confirmation-message":["Sample multi-line confirmation message","","Display info messages and instructions like roll back requires restarting node, ","(even though install didn't require restart), as snapshot needs to be reverted."],"requires-restart":true,"estimated-minutes":40},"commit":{"confirmation-message":["Sample multi-line confirmation message","","Display info messages and instructions like once update is committed, you cannot roll back."],"estimated-minutes":5}}]}
`,
},
want: map[string]string{
"ASUM RPM Format Version": "2",
"Architecture": "x86_64",
"Build Date": "Wed 22 Jul 2020 05:17:50 PM PDT",
"Build Host": "builder",
"Description": "",
"Group": "Unspecified",
"Install Date": "(not installed)",
"License": "Copyright (c) 2020 Veritas Technologies LLC. All rights reserved.",
"Name": "VRTSasum-update",
"Packager": "Veritas AS DevOps <[email protected]>",
"RPM Info": `{"Description":["Sample multi-line description of the update RPM.","Client scripts/GUI can display each item in this list in a separate para with appropriate linebreaks."],"Type":"Update","VersionInfo":[{"Version":"*","install":{"confirmation-message":["Sample multi-line confirmation message","","Display info messages and instructions like restarting node, ","and confirming that users have stopped instances."],"requires-restart":true,"supports-rollback":false,"estimated-minutes":35},"rollback":{"confirmation-message":["Sample multi-line confirmation message","","Display info messages and instructions like restarting node, ","and confirming that users have stopped instances."],"requires-restart":true,"estimated-minutes":20},"commit":{"confirmation-message":["Sample multi-line confirmation message","","Display info messages and instructions like once update is committed, you cannot roll back.","Also, committing node restarts some services."],"estimated-minutes":5}},{"Version":"3.*","install":{"confirmation-message":["Sample multi-line confirmation message","","Display warning messages and instructions like stopping instances."],"requires-restart":false,"supports-rollback":false,"estimated-minutes":25},"rollback":{"confirmation-message":["Sample multi-line confirmation message","","Display info messages and instructions like roll back requires restarting node, ","(even though install didn't require restart), as snapshot needs to be reverted."],"requires-restart":true,"estimated-minutes":40},"commit":{"confirmation-message":["Sample multi-line confirmation message","","Display info messages and instructions like once update is committed, you cannot roll back."],"estimated-minutes":5}}]}`,
"Release": "20200723001743",
"Relocations": "(not relocatable)",
"Signature": "RSA/SHA256, Mon 06 Jul 2020 02:41:26 PM PDT, Key ID cf784714d9712e70",
"Size": "6098439",
"Source RPM": "VRTSasum-update-2.0.1-20200723001743.src.rpm",
"Summary": "Sample Update RPM created using ASUM SDK",
"URL": "https://www.veritas.com/support/en_US.html",
"Version": "2.0.1",
"RPM Format Version": "2",
"Architecture": "x86_64",
"Build Date": "Wed 22 Jul 2020 05:17:50 PM PDT",
"Build Host": "builder",
"Description": "",
"Group": "Unspecified",
"Install Date": "(not installed)",
"License": "Copyright (c) 2020 Veritas Technologies LLC. All rights reserved.",
"Name": "VRTSasum-update",
"Packager": "Veritas AS DevOps <[email protected]>",
"RPM Info": `{"Description":["Sample multi-line description of the update RPM.","Client scripts/GUI can display each item in this list in a separate para with appropriate linebreaks."],"Type":"Update","VersionInfo":[{"Version":"*","install":{"confirmation-message":["Sample multi-line confirmation message","","Display info messages and instructions like restarting node, ","and confirming that users have stopped instances."],"requires-restart":true,"supports-rollback":false,"estimated-minutes":35},"rollback":{"confirmation-message":["Sample multi-line confirmation message","","Display info messages and instructions like restarting node, ","and confirming that users have stopped instances."],"requires-restart":true,"estimated-minutes":20},"commit":{"confirmation-message":["Sample multi-line confirmation message","","Display info messages and instructions like once update is committed, you cannot roll back.","Also, committing node restarts some services."],"estimated-minutes":5}},{"Version":"3.*","install":{"confirmation-message":["Sample multi-line confirmation message","","Display warning messages and instructions like stopping instances."],"requires-restart":false,"supports-rollback":false,"estimated-minutes":25},"rollback":{"confirmation-message":["Sample multi-line confirmation message","","Display info messages and instructions like roll back requires restarting node, ","(even though install didn't require restart), as snapshot needs to be reverted."],"requires-restart":true,"estimated-minutes":40},"commit":{"confirmation-message":["Sample multi-line confirmation message","","Display info messages and instructions like once update is committed, you cannot roll back."],"estimated-minutes":5}}]}`,
"Release": "20200723001743",
"Relocations": "(not relocatable)",
"Signature": "RSA/SHA256, Mon 06 Jul 2020 02:41:26 PM PDT, Key ID cf784714d9712e70",
"Size": "6098439",
"Source RPM": "VRTSasum-update-2.0.1-20200723001743.src.rpm",
"Summary": "Sample Update RPM created using ASUM SDK",
"URL": "https://www.veritas.com/support/en_US.html",
"Version": "2.0.1",
},
},
}
Expand Down

0 comments on commit 46aaefc

Please sign in to comment.