Skip to content

Commit 74238a8

Browse files
authored
chore: small gcs fixes (#380)
1 parent fd878df commit 74238a8

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

util/cloud/gcp/gcs.cc

+8-6
Original file line numberDiff line numberDiff line change
@@ -214,14 +214,16 @@ error_code GCPCredsProvider::Init(unsigned connect_ms) {
214214
} else {
215215
auto gcloudRoot = ExpandFilePath(kGcloudDir);
216216
if (gcloudRoot) {
217-
VLOG(1) << "Using ADC provided via gcloud CLI";
218-
RETURN_ERROR(LoadGCPConfig(gcloudRoot.value(), &account_id_, &project_id_));
217+
VLOG(1) << "Using ADC provided via gcloud CLI " << *gcloudRoot;
218+
219+
RETURN_ERROR(LoadGCPConfig(*gcloudRoot, &account_id_, &project_id_));
219220
if (account_id_.empty() || project_id_.empty()) {
220-
LOG(WARNING) << "gcloud config file is not valid";
221-
return make_error_code(errc::not_supported);
221+
LOG(WARNING) << "gcloud config file " << *gcloudRoot
222+
<< " is not valid, either project_id or account_id is empty";
223+
} else {
224+
adc_file =
225+
absl::StrCat(gcloudRoot.value(), kGcloudCredentialsFolder, account_id_, "/adc.json");
222226
}
223-
adc_file =
224-
absl::StrCat(gcloudRoot.value(), kGcloudCredentialsFolder, account_id_, "/adc.json");
225227
} else if (gcloudRoot.error() != errc::no_such_file_or_directory) {
226228
LOG(WARNING) << "error retrieving " << kGcloudDir;
227229
return gcloudRoot.error();

0 commit comments

Comments
 (0)