Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for s3.url_style path|virtual (default: virtual) #16

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/S3Commands.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
return AWSv4Impl::canonicalizeQueryString( query_parameters );
}

// Takes in the configured `s3.service_url` and uses the bucket/object requested to generate

Check warning on line 37 in src/S3Commands.cc

View workflow job for this annotation

GitHub Actions / Run linters

[lint] reported by reviewdog 🐶 Raw Output: src/S3Commands.cc:37:-// Takes in the configured `s3.service_url` and uses the bucket/object requested to generate src/S3Commands.cc:38:-// the virtual host URL, as well as the canonical URI (which is the path to the object). src/S3Commands.cc:39:-bool AmazonRequest::parseURL( const std::string & url, src/S3Commands.cc:40:- const std::string & bucket, src/S3Commands.cc:41:- const std::string & object, src/S3Commands.cc:42:- std::string & host, src/S3Commands.cc:43:- std::string & path ) { src/S3Commands.cc:44:- auto i = url.find( "://" ); src/S3Commands.cc:45:- if( i == std::string::npos ) { return false; } src/S3Commands.cc:46:- //protocol = substring( url, 0, i ); src/S3Commands.cc:47:- src/S3Commands.cc:48:- auto j = url.find( "/", i + 3 ); src/S3Commands.cc:49:- if( j == std::string::npos ) { src/S3Commands.cc:50:- if (style == "path") { src/S3Commands.cc:51:- host = substring( url, i + 3 ); src/S3Commands.cc:52:- } else { src/S3Commands.cc:53:- host = bucket + "." + substring( url, i + 3 ); src/S3Commands.cc:54:- } src/S3Commands.cc:55:- src/S3Commands.cc:56:- path = "/" + object; src/S3Commands.cc:57:- return true; src/S3Commands.cc:38:+// Takes in the configured `s3.service_url` and uses the bucket/object requested src/S3Commands.cc:39:+// to generate the virtual host URL, as well as the canonical URI (which is the src/S3Commands.cc:40:+// path to the object). src/S3Commands.cc:41:+bool AmazonRequest::parseURL(const std::string &url, const std::string &bucket, src/S3Commands.cc:42:+ const std::string &object, std::string &host, src/S3Commands.cc:43:+ std::string &path) { src/S3Commands.cc:44:+ auto i = url.find("://"); src/S3Commands.cc:45:+ if (i == std::string::npos) { src/S3Commands.cc:46:+ return false; src/S3Commands.cc:47:+ } src/S3Commands.cc:48:+ // protocol = substring( url, 0, i ); src/S3Commands.cc:49:+ src/S3Commands.cc:50:+ auto j = url.find("/", i + 3); src/S3Commands.cc:51:+ if (j == std::string::npos) { src/S3Commands.cc:52:+ if (style == "path") { src/S3Commands.cc:53:+ host = substring(url, i + 3); src/S3Commands.cc:54:+ } else { src/S3Commands.cc:55:+ host = bucket + "." + substring(url, i + 3);
// the virtual host URL, as well as the canonical URI (which is the path to the object).
bool AmazonRequest::parseURL( const std::string & url,
const std::string & bucket,
Expand All @@ -47,7 +47,12 @@

auto j = url.find( "/", i + 3 );
if( j == std::string::npos ) {
host = bucket + "." + substring( url, i + 3 );
if (style == "path") {
host = substring( url, i + 3 );
} else {
host = bucket + "." + substring( url, i + 3 );
}

path = "/" + object;
return true;
}
Expand Down
27 changes: 18 additions & 9 deletions src/S3Commands.hh
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@ public:
const std::string & skf,
const std::string & b,
const std::string & o,
const std::string & style,
int sv = 4
) :
HTTPRequest( s ),
accessKeyFile(akf),
secretKeyFile(skf),
signatureVersion(sv),
bucket(b),
object(o)
object(o),
style(style)
{
requiresSignature = true;
// Start off by parsing the hostUrl, which we use in conjunction with the bucket to fill in the host (for setting host header).
Expand All @@ -33,8 +35,11 @@ public:

// Now that we have the host and canonicalURI, we can build the actual url we perform the curl against.
// Using the previous example, we'd get a new hostUrl of "https://my-bucket.my-url.com:443/my-object".
hostUrl = protocol + "://" +
host + canonicalURI;
if (style == "path") {
hostUrl = protocol + "://" + host + "/" + b + canonicalURI;
} else {
hostUrl = protocol + "://" + host + canonicalURI;
}

// If we can, set the region based on the host.
size_t secondDot = host.find( ".", 2 + 1 );
Expand Down Expand Up @@ -77,6 +82,7 @@ protected:
std::string region;
std::string service;

std::string style;
private:
bool createV4Signature( const std::string & payload, std::string & authorizationHeader, bool sendContentSHA = false );

Expand All @@ -91,9 +97,10 @@ public:
const std::string & akf,
const std::string & skf,
const std::string & b,
const std::string & o
const std::string & o,
const std::string & style
) :
AmazonRequest(s, akf, skf, b, o){}
AmazonRequest(s, akf, skf, b, o, style){}

virtual ~AmazonS3Upload();

Expand All @@ -111,9 +118,10 @@ public:
const std::string & akf,
const std::string & skf,
const std::string & b,
const std::string & o
const std::string & o,
const std::string & style
) :
AmazonRequest(s, akf, skf, b, o){}
AmazonRequest(s, akf, skf, b, o, style){}

virtual ~AmazonS3Download();

Expand All @@ -128,9 +136,10 @@ public:
const std::string & akf,
const std::string & skf,
const std::string & b,
const std::string & o
const std::string & o,
const std::string & style
) :
AmazonRequest(s, akf, skf, b, o){}
AmazonRequest(s, akf, skf, b, o, style){}

virtual ~AmazonS3Head();

Expand Down
17 changes: 12 additions & 5 deletions src/S3File.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <sstream>
#include <vector>

#include <algorithm>
#include <filesystem>

#include <map>
jhiemstrawisc marked this conversation as resolved.
Show resolved Hide resolved
Expand Down Expand Up @@ -78,7 +79,7 @@
return 0;
}


Check warning on line 82 in src/S3File.cc

View workflow job for this annotation

GitHub Actions / Run linters

[lint] reported by reviewdog 🐶 Raw Output: src/S3File.cc:82:- src/S3File.cc:83:-int src/S3File.cc:84:-S3File::Open(const char *path, int Oflag, mode_t Mode, XrdOucEnv &env) src/S3File.cc:85:-{ src/S3File.cc:86:- std::string configured_s3_region = m_oss->getS3Region(); src/S3File.cc:87:- src/S3File.cc:88:- // src/S3File.cc:89:- // Check the path for validity. src/S3File.cc:90:- // src/S3File.cc:91:- std::string bucket, object; src/S3File.cc:92:- int rv = parse_path( * m_oss, path, bucket, object ); src/S3File.cc:93:- if( rv != 0 ) { return rv; } src/S3File.cc:94:- src/S3File.cc:95:- src/S3File.cc:96:- std::string configured_s3_service_url = m_oss->getS3ServiceURL(); src/S3File.cc:97:- std::string configured_s3_access_key = m_oss->getS3AccessKeyFile(); src/S3File.cc:98:- std::string configured_s3_secret_key = m_oss->getS3SecretKeyFile(); src/S3File.cc:99:- std::string configured_s3_url_style = m_oss->getS3URLStyle(); src/S3File.cc:100:- src/S3File.cc:101:- src/S3File.cc:102:- // We used to query S3 here to see if the object existed, but of course src/S3File.cc:103:- // if you're creating a file on upload, you don't care. src/S3File.cc:104:- src/S3File.cc:105:- this->s3_object_name = object; src/S3File.cc:106:- this->s3_bucket_name = bucket; src/S3File.cc:107:- this->s3_service_url = configured_s3_service_url; src/S3File.cc:108:- this->s3_access_key = configured_s3_access_key; src/S3File.cc:109:- this->s3_secret_key = configured_s3_secret_key; src/S3File.cc:110:- this->s3_url_style = configured_s3_url_style; src/S3File.cc:111:- return 0; src/S3File.cc:83:+int S3File::Open(const char *path, int Oflag, mode_t Mode, XrdOucEnv &env) { src/S3File.cc:84:+ std::string configured_s3_region = m_oss->getS3Region(); src/S3File.cc:85:+ src/S3File.cc:86:+ // src/S3File.cc:87:+ // Check the path for validity. src/S3File.cc:88:+ // src/S3File.cc:89:+ std::string bucket, object; src/S3File.cc:90:+ int rv = parse_path(*m_oss, path, bucket, object); src/S3File.cc:91:+ if (rv != 0) { src/S3File.cc:92:+ return rv; src/S3File.cc:93:+ } src/S3File.cc:94:+ src/S3File.cc:95:+ std::string configured_s3_service_url = m_oss->getS3ServiceURL(); src/S3File.cc:96:+ std::string configured_s3_access_key = m_oss->getS3AccessKeyFile(); src/S3File.cc:97:+ std::string configured_s3_secret_key = m_oss->getS3SecretKeyFile(); src/S3File.cc:98:+ std::string configured_s3_url_style = m_oss->getS3URLStyle(); src/S3File.cc:99:+ src/S3File.cc:100:+ // We used to query S3 here to see if the object existed, but of course src/S3File.cc:101:+ // if you're creating a file on upload, you don't care. src/S3File.cc:102:+ src/S3File.cc:103:+ this->s3_object_name = object; src/S3File.cc:104:+ this->s3_bucket_name = bucket; src/S3File.cc:105:+ this->s3_service_url = configured_s3_service_url; src/S3File.cc:106:+ this->s3_access_key = configured_s3_access_key; src/S3File.cc:107:+ this->s3_secret_key = configured_s3_secret_key; src/S3File.cc:108:+ this->s3_url_style = configured_s3_url_style; src/S3File.cc:109:+ return 0;
int
S3File::Open(const char *path, int Oflag, mode_t Mode, XrdOucEnv &env)
{
Expand All @@ -95,6 +96,7 @@
std::string configured_s3_service_url = m_oss->getS3ServiceURL();
std::string configured_s3_access_key = m_oss->getS3AccessKeyFile();
std::string configured_s3_secret_key = m_oss->getS3SecretKeyFile();
std::string configured_s3_url_style = m_oss->getS3URLStyle();


// We used to query S3 here to see if the object existed, but of course
Expand All @@ -105,11 +107,12 @@
this->s3_service_url = configured_s3_service_url;
this->s3_access_key = configured_s3_access_key;
this->s3_secret_key = configured_s3_secret_key;
this->s3_url_style = configured_s3_url_style;
return 0;
}


ssize_t

Check warning on line 115 in src/S3File.cc

View workflow job for this annotation

GitHub Actions / Run linters

[lint] reported by reviewdog 🐶 Raw Output: src/S3File.cc:115:-ssize_t src/S3File.cc:116:-S3File::Read(void *buffer, off_t offset, size_t size) src/S3File.cc:117:-{ src/S3File.cc:118:- AmazonS3Download download( src/S3File.cc:119:- this->s3_service_url, src/S3File.cc:120:- this->s3_access_key, src/S3File.cc:121:- this->s3_secret_key, src/S3File.cc:122:- this->s3_bucket_name, src/S3File.cc:123:- this->s3_object_name, src/S3File.cc:124:- this->s3_url_style src/S3File.cc:125:- ); src/S3File.cc:126:- src/S3File.cc:127:- src/S3File.cc:128:- if(! download.SendRequest( offset, size ) ) { src/S3File.cc:129:- fprintf( stderr, "D_FULLDEBUG: failed to send GetObject command: %lu '%s'\n", download.getResponseCode(), download.getResultString().c_str() ); src/S3File.cc:130:- return 0; src/S3File.cc:131:- } src/S3File.cc:117:+ if (!download.SendRequest(offset, size)) { src/S3File.cc:118:+ fprintf(stderr, "D_FULLDEBUG: failed to send GetObject command: %lu '%s'\n", src/S3File.cc:119:+ download.getResponseCode(), download.getResultString().c_str()); src/S3File.cc:120:+ return 0; src/S3File.cc:121:+ }
S3File::Read(void *buffer, off_t offset, size_t size)
{
AmazonS3Download download(
Expand All @@ -117,7 +120,8 @@
this->s3_access_key,
this->s3_secret_key,
this->s3_bucket_name,
this->s3_object_name
this->s3_object_name,
this->s3_url_style
);


Expand All @@ -131,7 +135,7 @@
return bytes.size();
}


Check warning on line 138 in src/S3File.cc

View workflow job for this annotation

GitHub Actions / Run linters

[lint] reported by reviewdog 🐶 Raw Output: src/S3File.cc:138:- src/S3File.cc:139:-int src/S3File.cc:140:-S3File::Fstat(struct stat *buff) src/S3File.cc:141:-{ src/S3File.cc:142:- AmazonS3Head head( src/S3File.cc:143:- this->s3_service_url, src/S3File.cc:144:- this->s3_access_key, src/S3File.cc:145:- this->s3_secret_key, src/S3File.cc:146:- this->s3_bucket_name, src/S3File.cc:147:- this->s3_object_name, src/S3File.cc:148:- this->s3_url_style src/S3File.cc:149:- ); src/S3File.cc:150:- src/S3File.cc:151:- if(! head.SendRequest()) { src/S3File.cc:152:- // SendRequest() returns false for all errors, including ones src/S3File.cc:153:- // where the server properly responded with something other src/S3File.cc:154:- // than code 200. If xrootd wants us to distinguish between src/S3File.cc:155:- // these cases, head.getResponseCode() is initialized to 0, so src/S3File.cc:156:- // we can check. src/S3File.cc:157:- fprintf( stderr, "D_FULLDEBUG: failed to send HeadObject command: %lu '%s'\n", head.getResponseCode(), head.getResultString().c_str() ); src/S3File.cc:158:- return -ENOENT; src/S3File.cc:159:- } src/S3File.cc:160:- src/S3File.cc:161:- src/S3File.cc:162:- std::string headers = head.getResultString(); src/S3File.cc:163:- src/S3File.cc:164:- std::string line; src/S3File.cc:165:- size_t current_newline = 0; src/S3File.cc:166:- size_t next_newline = std::string::npos; src/S3File.cc:167:- size_t last_character = headers.size(); src/S3File.cc:168:- while( current_newline != std::string::npos && current_newline != last_character - 1 ) { src/S3File.cc:169:- next_newline = headers.find( "\r\n", current_newline + 2); src/S3File.cc:170:- std::string line = substring( headers, current_newline + 2, next_newline ); src/S3File.cc:171:- src/S3File.cc:172:- size_t colon = line.find(":"); src/S3File.cc:173:- if( colon != std::string::npos && colon != line.size() ) { src/S3File.cc:174:- std::string attr = substring( line, 0, colon ); src/S3File.cc:175:- std::string value = substring( line, colon + 1 ); src/S3File.cc:176:- trim(value); src/S3File.cc:177:- std::transform(attr.begin(), attr.end(), attr.begin(), ::tolower); src/S3File.cc:178:- src/S3File.cc:179:- if( attr == "content-length" ) { src/S3File.cc:180:- this->content_length = std::stol(value); src/S3File.cc:181:- } else if( attr == "last-modified" ) { src/S3File.cc:182:- struct tm t; src/S3File.cc:183:- char * eos = strptime( value.c_str(), src/S3File.cc:184:- "%a, %d %b %Y %T %Z", src/S3File.cc:185:- & t ); src/S3File.cc:186:- if( eos == & value.c_str()[value.size()] ) { src/S3File.cc:187:- time_t epoch = timegm(& t); src/S3File.cc:188:- if( epoch != -1 ) { src/S3File.cc:189:- this->last_modified = epoch; src/S3File.cc:190:- } src/S3File.cc:191:- } src/S3File.cc:192:- } src/S3File.cc:128:+int S3File::Fstat(struct stat *buff) { src/S3File.cc:129:+ AmazonS3Head head(this->s3_service_url, this->s3_access_key, src/S3File.cc:130:+ this->s3_secret_key, this->s3_bucket_name, src/S3File.cc:131:+ this->s3_object_name, this->s3_url_style); src/S3File.cc:132:+ src/S3File.cc:133:+ if (!head.SendRequest()) { src/S3File.cc:134:+ // SendRequest() returns false for all errors, including ones src/S3File.cc:135:+ // where the server properly responded with something other src/S3File.cc:136:+ // than code 200. If xrootd wants us to distinguish between src/S3File.cc:137:+ // these cases, head.getResponseCode() is initialized to 0, so src/S3File.cc:138:+ // we can check. src/S3File.cc:139:+ fprintf(stderr, src/S3File.cc:140:+ "D_FULLDEBUG: failed to send HeadObject command: %lu '%s'\n", src/S3File.cc:141:+ he
int
S3File::Fstat(struct stat *buff)
{
Expand All @@ -140,7 +144,8 @@
this->s3_access_key,
this->s3_secret_key,
this->s3_bucket_name,
this->s3_object_name
this->s3_object_name,
this->s3_url_style
);

if(! head.SendRequest()) {
Expand Down Expand Up @@ -169,10 +174,11 @@
std::string attr = substring( line, 0, colon );
std::string value = substring( line, colon + 1 );
trim(value);
std::transform(attr.begin(), attr.end(), attr.begin(), ::tolower);

if( attr == "Content-Length" ) {
if( attr == "content-length" ) {
this->content_length = std::stol(value);
} else if( attr == "Last-Modified" ) {
} else if( attr == "last-modified" ) {
struct tm t;
char * eos = strptime( value.c_str(),
"%a, %d %b %Y %T %Z",
Expand Down Expand Up @@ -204,7 +210,7 @@
return 0;
}


Check warning on line 213 in src/S3File.cc

View workflow job for this annotation

GitHub Actions / Run linters

[lint] reported by reviewdog 🐶 Raw Output: src/S3File.cc:213:- src/S3File.cc:214:-ssize_t src/S3File.cc:215:-S3File::Write(const void *buffer, off_t offset, size_t size) src/S3File.cc:216:-{ src/S3File.cc:217:- AmazonS3Upload upload( src/S3File.cc:218:- this->s3_service_url, src/S3File.cc:219:- this->s3_access_key, src/S3File.cc:220:- this->s3_secret_key, src/S3File.cc:221:- this->s3_bucket_name, src/S3File.cc:222:- this->s3_object_name, src/S3File.cc:223:- this->s3_url_style src/S3File.cc:224:- ); src/S3File.cc:225:- src/S3File.cc:226:- std::string payload( (char *)buffer, size ); src/S3File.cc:227:- if(! upload.SendRequest( payload, offset, size )) { src/S3File.cc:228:- m_log.Emsg( "Open", "upload.SendRequest() failed" ); src/S3File.cc:229:- return -ENOENT; src/S3File.cc:230:- } else { src/S3File.cc:231:- m_log.Emsg( "Open", "upload.SendRequest() succeeded" ); src/S3File.cc:232:- return 0; src/S3File.cc:233:- } src/S3File.cc:234:-} src/S3File.cc:235:- src/S3File.cc:236:- src/S3File.cc:237:-int S3File::Close(long long *retsz) src/S3File.cc:238:-{ src/S3File.cc:239:- m_log.Emsg("Close", "Closed our S3 file"); src/S3File.cc:194:+ssize_t S3File::Write(const void *buffer, off_t offset, size_t size) { src/S3File.cc:195:+ AmazonS3Upload upload(this->s3_service_url, this->s3_access_key, src/S3File.cc:196:+ this->s3_secret_key, this->s3_bucket_name, src/S3File.cc:197:+ this->s3_object_name, this->s3_url_style); src/S3File.cc:198:+ src/S3File.cc:199:+ std::string payload((char *)buffer, size); src/S3File.cc:200:+ if (!upload.SendRequest(payload, offset, size)) { src/S3File.cc:201:+ m_log.Emsg("Open", "upload.SendRequest() failed"); src/S3File.cc:202:+ return -ENOENT; src/S3File.cc:203:+ } else { src/S3File.cc:204:+ m_log.Emsg("Open", "upload.SendRequest() succeeded");
ssize_t
S3File::Write(const void *buffer, off_t offset, size_t size)
{
Expand All @@ -213,7 +219,8 @@
this->s3_access_key,
this->s3_secret_key,
this->s3_bucket_name,
this->s3_object_name
this->s3_object_name,
this->s3_url_style
);

std::string payload( (char *)buffer, size );
Expand Down
1 change: 1 addition & 0 deletions src/S3File.hh
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ private:
std::string s3_object_name;
std::string s3_access_key;
std::string s3_secret_key;
std::string s3_url_style;

size_t content_length;
time_t last_modified;
Expand Down
9 changes: 9 additions & 0 deletions src/S3FileSystem.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
}

char * temporary;
std::string value;

Check warning on line 69 in src/S3FileSystem.cc

View workflow job for this annotation

GitHub Actions / Run linters

[lint] reported by reviewdog 🐶 Raw Output: src/S3FileSystem.cc:68:- char * temporary; src/S3FileSystem.cc:69:- std::string value; src/S3FileSystem.cc:70:- std::string attribute; src/S3FileSystem.cc:71:- Config.Attach(cfgFD); src/S3FileSystem.cc:72:- while ((temporary = Config.GetMyFirstWord())) { src/S3FileSystem.cc:73:- attribute = temporary; src/S3FileSystem.cc:74:- temporary = Config.GetWord(); src/S3FileSystem.cc:75:- if(! temporary) { continue; } src/S3FileSystem.cc:76:- value = temporary; src/S3FileSystem.cc:77:- src/S3FileSystem.cc:78:- if(! handle_required_config( attribute, "s3.service_name", src/S3FileSystem.cc:79:- value, this->s3_service_name ) ) { Config.Close(); return false; } src/S3FileSystem.cc:80:- if(! handle_required_config( attribute, "s3.region", src/S3FileSystem.cc:81:- value, this->s3_region ) ) { Config.Close(); return false; } src/S3FileSystem.cc:82:- if(! handle_required_config( attribute, "s3.service_url", src/S3FileSystem.cc:83:- value, this->s3_service_url ) ) { Config.Close(); return false; } src/S3FileSystem.cc:84:- if(! handle_required_config( attribute, "s3.access_key_file", src/S3FileSystem.cc:85:- value, this->s3_access_key_file ) ) { Config.Close(); return false; } src/S3FileSystem.cc:86:- if(! handle_required_config( attribute, "s3.secret_key_file", src/S3FileSystem.cc:87:- value, this->s3_secret_key_file ) ) { Config.Close(); return false; } src/S3FileSystem.cc:88:- if(! handle_required_config( attribute, "s3.url_style", src/S3FileSystem.cc:89:- value, this->s3_url_style ) ) { Config.Close(); return false; } src/S3FileSystem.cc:72:+ if (!handle_required_config(attribute, "s3.service_name", value, src/S3FileSystem.cc:73:+ this->s3_service_name)) { src/S3FileSystem.cc:74:+ Config.Close(); src/S3FileSystem.cc:75:+ return false;
std::string attribute;
Config.Attach(cfgFD);
while ((temporary = Config.GetMyFirstWord())) {
Expand All @@ -85,9 +85,11 @@
value, this->s3_access_key_file ) ) { Config.Close(); return false; }
if(! handle_required_config( attribute, "s3.secret_key_file",
value, this->s3_secret_key_file ) ) { Config.Close(); return false; }
if(! handle_required_config( attribute, "s3.url_style",
value, this->s3_url_style ) ) { Config.Close(); return false; }
}

if( this->s3_service_name.empty() ) {

Check warning on line 92 in src/S3FileSystem.cc

View workflow job for this annotation

GitHub Actions / Run linters

[lint] reported by reviewdog 🐶 Raw Output: src/S3FileSystem.cc:91:- src/S3FileSystem.cc:92:- if( this->s3_service_name.empty() ) { src/S3FileSystem.cc:93:- m_log.Emsg("Config", "s3.service_name not specified"); src/S3FileSystem.cc:94:- return false; src/S3FileSystem.cc:77:+ if (!handle_required_config(attribute, "s3.region", value, src/S3FileSystem.cc:78:+ this->s3_region)) { src/S3FileSystem.cc:79:+ Config.Close(); src/S3FileSystem.cc:80:+ return false;
m_log.Emsg("Config", "s3.service_name not specified");
return false;
}
Expand All @@ -95,8 +97,15 @@
m_log.Emsg("Config", "s3.region not specified");
return false;
}
jhiemstrawisc marked this conversation as resolved.
Show resolved Hide resolved
if( this->s3_url_style.empty() ) {
this->s3_url_style = "virtual";
}
jhiemstrawisc marked this conversation as resolved.
Show resolved Hide resolved
if( this->s3_url_style != "virtual" && this->s3_url_style != "path" ) {
m_log.Emsg("Config", "invalid s3.url_style specified");
return false;
}
jhiemstrawisc marked this conversation as resolved.
Show resolved Hide resolved

int retc = Config.LastError();

Check warning on line 108 in src/S3FileSystem.cc

View workflow job for this annotation

GitHub Actions / Run linters

[lint] reported by reviewdog 🐶 Raw Output: src/S3FileSystem.cc:107:- src/S3FileSystem.cc:108:- int retc = Config.LastError(); src/S3FileSystem.cc:109:- if( retc ) { src/S3FileSystem.cc:110:- m_log.Emsg("Config", -retc, "read config file", configfn); src/S3FileSystem.cc:111:- Config.Close(); src/S3FileSystem.cc:112:- return false; src/S3FileSystem.cc:97:+ if (!handle_required_config(attribute, "s3.url_style", value, src/S3FileSystem.cc:98:+ this->s3_url_style)) { src/S3FileSystem.cc:99:+ Config.Close(); src/S3FileSystem.cc:100:+ return false;
if( retc ) {
m_log.Emsg("Config", -retc, "read config file", configfn);
Config.Close();
Expand Down
3 changes: 3 additions & 0 deletions src/S3FileSystem.hh
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public:
const std::string & getS3ServiceName() const { return s3_service_name; }
const std::string & getS3Region() const { return s3_region; }
const std::string & getS3ServiceURL() const { return s3_service_url; }
const std::string & getS3URLStyle() const { return s3_url_style; }

const std::string & getS3AccessKeyFile() const { return s3_access_key_file; }
const std::string & getS3SecretKeyFile() const { return s3_secret_key_file; }
Expand All @@ -81,4 +82,6 @@ private:

std::string s3_access_key_file;
std::string s3_secret_key_file;

std::string s3_url_style;
};
Loading