Fix use of S3 with a non-aws appliances

re: https://github.com/Unidata/netcdf-c/issues/2151

The of a non-aws appliance broke during the switch to testing
against Amazon S3.
So make necessary changes to get non-aws appliances work correctly.
This commit is contained in:
Dennis Heimbigner 2021-11-25 18:26:03 -07:00
parent 26ac2a6cba
commit c01cf995c0
5 changed files with 20 additions and 15 deletions

View File

@ -7,6 +7,7 @@ This file contains a high-level description of this package's evolution. Release
## 4.8.2 - TBD
* [Bug Fix] Fix use of non-aws appliances. See [Github #????](https://github.com/Unidata/netcdf-c/pull/????).
* [Enhancement] Added options to suppress the new behavior from [Github #2135](https://github.com/Unidata/netcdf-c/pull/2135). The options for `cmake` and `configure` are, respectively `-DENABLE_LIBXML2` and `--(enable/disable)-libxml2`. Both of these options defaul to 'on/enabled'. When disabled, the bundled `ezxml` XML interpreter is used regardless of whether `libxml2` is present on the system.
* [Enhancement] Support optional use of libxml2, otherwise default to ezxml. See [Github #2135](https://github.com/Unidata/netcdf-c/pull/2135) -- H/T to [Egbert Eich](https://github.com/e4t).
* [Bug Fix] Fix several os related errors. See [Github #2138](https://github.com/Unidata/netcdf-c/pull/2138).

View File

@ -119,11 +119,12 @@ NC_s3urlrebuild(NCURI* url, NCURI** newurlp, char** bucketp, char** outregionp)
if((stat = NC_getdefaults3region(url,&region0))) goto done;
region = strdup(region0);
}
/* Construct the revised host */
ncbytescat(buf,"s3.");
ncbytescat(buf,region);
ncbytescat(buf,AWSHOST);
host = ncbytesextract(buf);
if(host == NULL) { /* Construct the revised host */
ncbytescat(buf,"s3.");
ncbytescat(buf,region);
ncbytescat(buf,AWSHOST);
host = ncbytesextract(buf);
}
/* Construct the revised path */
ncbytesclear(buf);

View File

@ -47,8 +47,8 @@ extern int NC_HDF4_finalize(void);
#endif
#ifdef ENABLE_S3_SDK
extern int NC_s3sdkinitialize(void);
extern int NC_s3sdkfinalize(void);
EXTERNL int NC_s3sdkinitialize(void);
EXTERNL int NC_s3sdkfinalize(void);
#endif
#ifdef _MSC_VER

View File

@ -87,7 +87,7 @@ main(int argc, char** argv)
}
url = nc_findtestserver(servlet,serverlist);
if(url == NULL) {
url = "";
url = strdup("");
fprintf(stderr,"not found: %s\n",servlet);
}
printf("%s",url);

View File

@ -69,19 +69,22 @@ case "$zext" in
testcasezip ref_quotes zarr metaonly
;;
s3)
# Read a test case created by netcdf-java zarr.
# Move into position
rm -f ${execdir}/ref_zarr_test_data.cdl
if gunzip -c < ${srcdir}/ref_zarr_test_data.cdl.gz > ${execdir}/ref_zarr_test_data.cdl ; then
testcases3 zarr_test_data.zarr ref_zarr_test_data xarray
# Test file does not exist on stratus
if test "x$NCZARR_S3_TEST_HOST" = "xs3.us-east-1.amazonaws.com" ; then
# Read a test case created by netcdf-java zarr.
# Move into position
rm -f ${execdir}/ref_zarr_test_data.cdl
if gunzip -c < ${srcdir}/ref_zarr_test_data.cdl.gz > ${execdir}/ref_zarr_test_data.cdl ; then
testcases3 zarr_test_data.zarr ref_zarr_test_data xarray
fi
fi
;;
*) echo "unimplemented kind: $1" ; exit 1;;
esac
}
#testallcases file
#if test "x$FEATURE_NCZARR_ZIP" = xyes ; then testallcases zip; fi
testallcases file
if test "x$FEATURE_NCZARR_ZIP" = xyes ; then testallcases zip; fi
if test "x$FEATURE_S3TESTS" = xyes ; then testallcases s3; fi
exit
# Cleanup