Audit an upgrade bundle before it ships

The bundle audit checks an upgrade bundle before it reaches a server. It finds mistakes that would change a running container by accident. This page shows what it checks, how to read the report, and what to do about each finding.

What the bundle audit is

The audit is a check of one bundle against the inventory of each server. The inventory is the saved picture of what runs on that server today.

For every container, the audit works out the settings the container gets after the upgrade. Then it compares them with the settings the container has today. It reports every setting that changes. It also reports the mistakes in seven groups, B1 to B7.

The audit only reads. It does not change the bundle.

When the audit runs

The audit runs in two places.

  • Inside Deployment Manager (DM), automatically. It runs when you download a bundle, when you build a bundle with images, when you deploy by SSH, and when you run a test install.

  • On your computer, by hand. You run the command line tool on a bundle that is already unpacked.

Run the audit by hand

Use this when a bundle already left DM and you want to check it.

  1. Unpack the bundle. You get one folder for each server.

  2. Put the inventory files of those servers in one folder. They are .json files.

  3. Open a terminal in the backend folder of Deployment Manager.

  4. Run this command.

cd backend && venv/bin/python -m cli.bundle_audit <bundle dir> <inventory dir> [--catalogue DIR]

<bundle dir> is the unpacked bundle. <inventory dir> is the folder with the inventory files. --catalogue DIR is optional. It is the catalogue folder with the contracts/ folder inside. Check B7 needs it. Without it, B7 prints one INFO line and checks nothing.

The tool matches each server folder to an inventory. It uses inventory_sha and site_key_id from the adoption.tsv file of that server. If no inventory matches, the server gets the line AUDIT WARN not audited.

The tool reads only normal files. It refuses a symlink. It refuses a file that is larger than 4 MB. An error message names the path. It never prints the content of a file.

Table 1. Exit codes
Code Meaning

0

No ERROR. There can be WARN and INFO lines.

1

At least one ERROR.

2

Bad input. A path is wrong, a file is a symlink or too large, or an inventory is not valid.

How to read the report

The report starts with a short header and a line Total: errors=<n> warnings=<n>. Then each server has its own block.

A server block has this shape.

== server-1 ==
errors=1 warnings=2
Findings:
  ERROR B5 ui-backend JAVA_OPTS: ...
  WARN B6 portals FT_UI_HOST: ...
Changes after the upgrade:
  ui-backend JAVA_OPTS CHANGED: ... -> ...
  unchanged: 41 keys

Each finding line has the level, the check name, the container, the key, and a sentence. A dash means there is no container or no key.

The four levels

Level What it means and what you do

ERROR

The audit proved a problem. DM refuses to ship the bundle. Fix the cause and create the bundle again.

WARN

A likely problem. The bundle ships. Read each WARN and decide.

INFO

A note. No action is needed.

UNVERIFIABLE

A WARN where the audit cannot compare two values. One value is a secret and the other is plain text. You run a check on the server. See The server check.

The changes list

The list Changes after the upgrade shows every setting that changes. Each line has one of these states.

State Meaning

NEW

The setting does not exist today. The bundle adds it.

CHANGED

The setting exists today. The bundle gives it another value.

DROPPED

The container has the setting today. After the upgrade it does not.

PROMPTED

The installer asks for the value at the deploy.

UNVERIFIABLE

The audit cannot compare the old and new value.

A setting that does not change is only counted in the line unchanged: <n> keys.

The audit never prints a secret value. For a secret it prints only one word: changed, unchanged, unknown or prompted.

The server check

An UNVERIFIABLE finding has a line that starts with check:. It is one command for you to run on the server. It compares the value in the container with the value in the delivered bundle file. It prints only 1 or 0. It never prints a value.

  • 1 means the two values are equal. Nothing changes. The finding is harmless.

  • 0 means the values differ. The container changes after the upgrade. Find out why before you ship.

The seven checks B1 to B7

Each check has a code, B1 to B7.

Check Level What it finds What you do

B1

ERROR or WARN

ERROR: one host port is published twice after the upgrade. WARN: a published port is used today by something outside this installation, such as another program or another project. The installer asks again on the server and stops there if the port is still taken.

Change the port in the bundle, or stop the other user of the port.

B2

ERROR or WARN

ERROR: a secret that the bundle writes is different from the secret a container runs with today. The container would change password. WARN: the bundle writes a secret from another source, but no container here runs or reads that secret today.

For an ERROR, make the bundle use the value the container has today. For a WARN, check that the right source is used.

B3

ERROR or WARN

ERROR: the installer will ask for a secret, but a container already runs with one today. WARN: the installer will ask for a secret, but the server already has the same secret under another name.

Give the value that runs today when the installer asks. If you do not, the container changes password.

B4

ERROR

A server identity setting has the same value on two or more servers for the same service. The settings are INSTANCE_NAME, HZ_PUBLIC_ADDRESS, HOST_FQDN and SERVER_NAME.

Give each server its own value.

B5

ERROR or WARN

A list of options, such as JAVA_OPTS, loses an option that it has today. The audit compares options by name. A new value under the same name, such as another -Xmx size, is not a loss.

For an ERROR, put the option back. For a WARN, see below.

B6

WARN, ERROR or INFO

A setting changes value, or has an old name and a new name. A new address setting, such as one that ends in _HOST, _URL, _ADDRESS or _FQDN, holds the address of this same server. A secret and a plain value cannot be compared.

Read the sentence. Run the server check for UNVERIFIABLE. For an address, point the setting at the other side.

B7

WARN or INFO

A new key in a bundle file. No container reads it, no container has it today, and no contract declares it.

Check that the key is meant to be there. Remove it if it is not.

More about B5

B5 prints a dropped option by name only. It never prints the value of the option.

If a dropped option is matched by a new key in the same container, B5 gives a WARN. Example: the option -Dhazelcast.local.publicAddress is gone and the container gains HZ_PUBLIC_ADDRESS. The setting probably moved. Check that the new key carries the same value.

If no new key matches the dropped option, B5 gives an ERROR.

A one-word value that changes, such as LOG_LEVEL from INFO to DEBUG, is not a B5 finding. It is a CHANGED setting.

More about B6

B6 checks one setting in three ways.

  • The same key. If both values are plain and differ, the result is a WARN (CHANGED). If one is a secret and one is plain, the result is UNVERIFIABLE.

  • An old name and a new name. Example: MYSQL_USER and DB_USER. Two secrets that differ are an ERROR. Two plain values that differ are a WARN.

  • A new address key. The key name ends in _HOST, _URL, _ADDRESS or _FQDN. If its value holds the address of this server, the result is a WARN. If DM does not know the address of the server, the audit prints the INFO own address unknown, addressing check skipped.

What DM does with the result

DM audits the bundle and puts the report in the zip file. Each audited server has its own file: <server>/bundle-audit.txt. The file holds the findings of that server.

When there are warnings only

The bundle ships. The download has the response header X-Bundle-Audit: errors=0 warnings=<n>. The screen shows a message that says how many warnings there are and which file to read.

Open each bundle-audit.txt and read the WARN lines before you give the bundle to the site.

When there is an ERROR

DM refuses to ship the bundle. This is true for the download, for the build with images, and for the SSH deploy. The refusal has the code bundle_audit_failed. The message says how many errors there are. The hint lists the first 10 errors, then +N more.

In the SSH deploy, the screen shows the refusal in the deploy panel. It does not start a run.

The refusal is the only thing you see if you are not an administrator. Tell an administrator, or fix the cause and create the bundle again.

Administrator override

An administrator can ship a bundle that has errors. Use it only when you understand each ERROR and accept the risk.

Only the roles support_admin and global_admin can do this.

How to override

  1. Read the errors in the confirm window. They are grouped by what breaks: ports that clash, the same identity on two servers, settings that would be lost, passwords that would change, and passwords you must type at the deploy. Each group says what happens if nobody fixes it. An error that is the same on several servers is one row with the server names under it.

  2. To fix a group instead, press its button. Open Variables opens the installation’s values, for ports, identities and lost settings. It opens at the field, and at that server’s own value when the field has one. For a port it opens the service’s card. Open the upgrade review opens the review at the server’s Secrets read from the server, where you choose where the upgrade reads each password. Nothing is downloaded or deployed. A test install offers no such button, because leaving would stop watching the test servers.

  3. Press the confirm button. The text is Download anyway. For an SSH deploy it is Deploy anyway, for a test install Install anyway.

  4. DM sends the same request again with the bundle fingerprint and the error codes.

Rules of the override

  • It names the error codes that you accept. If the bundle has a new error code, the override is refused.

  • It applies to that exact bundle only. The fingerprint (audit_sha) comes from the content of all bundle files. If you create the bundle again and any file changes, you must confirm again.

  • DM writes it in the Operations journal. The row has the action bundle_audit_override. It records who confirmed, when, the bundle fingerprint, and the error codes. It also records the path: download, image bundle or deploy.

  • DM writes the journal row before it hands out the bundle. If DM cannot write the row, nothing is handed out. The refusal has the code audit_override_unrecorded. Try again later.

  • The bundle still holds bundle-audit.txt with all findings.

  • A successful override sets the header to X-Bundle-Audit: errors=<n> warnings=<n> accepted=1.

What the audit does not cover

The audit has limits. Know them.

  • A server with no inventory is not audited. DM prints nothing for it.

  • A server that DM already installed is not audited. Its status is running, confirmed or confirmed-with-drift. DM prints the INFO line installed by DM before: the three-way merge is not modelled, not audited.

  • A server that you only downloaded a bundle for is audited. A download alone is not an install.

  • A setting that a container gets only from its image is not shown. No bundle file and no compose entry sets it.

  • A server line written as a comment (# NAME=) or with spaces around the equals sign (NAME = v) is invisible to the audit. The audit treats the key as absent.

  • A holder of a port outside the installation is treated as holding the port on every address.

  • If the audit itself fails, DM does not stop the download. It prints the WARN audit could not run: <error class>. Read the bundle by hand in this case.

  • The audit never prints a secret value. It is not shown in the report, the refusal, the journal, the log or the server check.