restic handler with Swift misses some environment variables
Hi, posting here for the sake of documenting my findings. This was found through trial and error, I haven't enough knowledge of Swift and backupninja to know for sure what the problem is.
For it to work with servers.com cloud storage I have had to modify the restic handler a bit to remove some mandatory environment variables and add some other, otherwise it would fail on authenticating.
I have simply removed the line that fatals when one of the variable is missing, it seems the client gets confused depending on which variable is set or not, ending with authentication errors.
I have added 3 more variables. First at the top of the file in the swift setsection
, then in the export section that sets the environment variables for restic. And I almost forgot the unset
lines at the end of the file, important! :)
The according values also have to be added to the *.restic file and variables like os_tenant_id can be left commented out.
If that is allowed, I suggest that no variable should be mandatory in the *.restic file and the choice of which to enable by uncommenting the line should be left to the user depending on their Swift authentication requirements.
The OpenStack Swift repository section for servers.com looks like that:
# OpenStack Swift repository
if [ "$(echo "$repository" | /usr/bin/awk -F ':' '{print $1}')" == "swift" ]; then
export_debug OS_AUTH_URL "$os_auth_url"
#export_debug OS_TENANT_ID "$os_tenant_id"
export_debug OS_TENANT_NAME "$os_tenant_name"
export_debug OS_USERNAME "$os_username"
export_debug OS_PASSWORD "$os_password"
#export_debug OS_REGION_NAME "$os_region_name"
export_debug OS_USER_DOMAIN_NAME "$os_user_domain_name"
export_debug OS_DEFAULT_DOMAIN_NAME "$os_default_domain_name"
export_debug OS_IDENTITY_API_VERSION "$os_identity_api_version"
fi
Restic issue that put me on the right track: https://forum.restic.net/t/where-to-find-an-existing-swift-container-name/3664