How to programmatically know "tools version"?

We have a tool that is a wrapper for, and eventually invokes, asbackup.

The documentation for asbackup states that -b option is to be used to control the string formatting option (encoded or not) up till a certain tools version, after which that option is deprecated and the -S option must then be used from that point forward.

We are currently on a version that still supports -b and -S is not yet supported (indicates “invalid option” if we use it).

Our goal: Write our code now so that it will automatically invoke asbackup with the correct option, -b or -S, depending on the tools version in that particular deployment. And so that our code doesn’t get broken in the future when -b is silently deprecated and we will no longer have our tool working like we think.

Question: Is there a way to programmatically know the “tools version”?

To programmatically get the version of the Tools package run on RHEL run:

rpm -qi aerospike-tools

However, it sounds like you would not want to use the -S option. As of 3.3.24 -b became the default behavior and specifying -b doesn’t change anything about the execution. As of 3.3.26 we introduce -S which allows to use the pre 3.3.24 tool behavior which is unsafe for many string encodings such as UTF8.

So basically, the question is whether to -b or not to -b. :smile:

1 Like