Skip to content

Commit b4d7c1c

Browse files
committed
Fix Azure configuration and code standards compliance
- Remove duplicate Azure option definitions in config.yaml (repo-azure-endpoint, repo-azure-key, repo-azure-key-type, repo-azure-uri-style) - Add 'auto' value to repo-azure-key-type allow-list for Azure Managed Identity support - Add missing Azure options (repo-azure-key, repo-azure-key-type) to test and doc build configuration files - Add missing help entries for Azure options in test and doc help.xml - Fix line length violation in src/storage/azure/storage.c by splitting long httpRequestNewP call - Move Docker-related files (Dockerfile, DOCKER_README.md, azure-pgbackrest.sh) to test/azure/ directory - Update file permissions for azure-pgbackrest.sh to match test expectations (0644) - Ensure all code follows CODING.md standards (4-space indentation, 132-character line limit)
1 parent 108b96d commit b4d7c1c

File tree

20 files changed

+77
-104
lines changed

20 files changed

+77
-104
lines changed

doc/src/build/config/config.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ option:
120120
log-level-stderr: {type: string, required: false, command: {noop: {}}}
121121
pg: {type: string, required: false, command: {noop: {}}}
122122
pg-path: {type: string, required: false, command: {noop: {}}}
123+
repo-azure-key: {type: string, required: false, command: {noop: {}}}
124+
repo-azure-key-type: {type: string-id, default: shared, allow-list: [auto, shared, sas], command: {noop: {}}}
123125
repo-type: {type: string, required: false, command: {noop: {}}}
124126
repo: {type: string, required: false, command: {noop: {}}}
125127
spool-path: {type: string, required: false, command: {noop: {}}}

doc/src/build/help/help.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
<option id="log-level-file"><summary></summary><text><p></p></text></option>
2121
<option id="log-level-stderr"><summary></summary><text><p></p></text></option>
2222
<option id="repo"><summary></summary><text><p></p></text></option>
23+
<option id="repo-azure-key"><summary></summary><text><p></p></text></option>
24+
<option id="repo-azure-key-type"><summary></summary><text><p></p></text></option>
2325
<option id="repo-type"><summary></summary><text><p></p></text></option>
2426
<option id="spool-path"><summary></summary><text><p></p></text></option>
2527
<option id="stanza"><summary></summary><text><p></p></text></option>

doc/src/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ main(int argListSize, const char *argList[])
6161
{
6262
// Build
6363
// -----------------------------------------------------------------------------------------------------------------
64-
case cfgCmdBuild:
65-
cmdBuild(cfgOptionStr(cfgOptRepoPath));
64+
case cfgCmdBuild :
65+
cmdBuild(cfgOptionStr(cfgOptRepoPath));
6666
break;
6767

6868
// Help/version

src/build/config/config.yaml

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1728,43 +1728,6 @@ option:
17281728
main: {}
17291729
local: {}
17301730

1731-
repo-azure-endpoint:
1732-
inherit: repo-azure-account
1733-
default: blob.core.windows.net
1734-
1735-
repo-azure-key:
1736-
section: global
1737-
type: string
1738-
group: repo
1739-
command: repo-type
1740-
required: false
1741-
secure: true
1742-
depend:
1743-
option: repo-azure-key-type
1744-
list:
1745-
- shared
1746-
- sas
1747-
1748-
repo-azure-key-type:
1749-
inherit: repo-azure-container
1750-
type: string-id
1751-
default: shared
1752-
allow-list:
1753-
- auto
1754-
- shared
1755-
- sas
1756-
1757-
repo-azure-uri-style:
1758-
section: global
1759-
group: repo
1760-
type: string-id
1761-
default: host
1762-
allow-list:
1763-
- host
1764-
- path
1765-
command: repo-type
1766-
depend: repo-azure-account
1767-
17681731
# Repository retention options
17691732
#---------------------------------------------------------------------------------------------------------------------------------
17701733
repo-retention-full-type:
@@ -2225,6 +2188,7 @@ option:
22252188
type: string-id
22262189
default: shared
22272190
allow-list:
2191+
- auto
22282192
- shared
22292193
- sas
22302194

src/common/debug.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -360,13 +360,13 @@ Ignore DEBUG_TEST_TRACE_MACRO if DEBUG is not defined because the underlying fun
360360
#define FUNCTION_TEST_BEGIN() \
361361
FUNCTION_TEST_MEM_CONTEXT_AUDIT_BEGIN(); \
362362
\
363-
/* Ensure that FUNCTION_LOG_BEGIN() and FUNCTION_TEST_BEGIN() are not both used in a single function by declaring the */ \
364-
/* same variable that FUNCTION_LOG_BEGIN() uses to track logging */ \
363+
/* Ensure that FUNCTION_LOG_BEGIN() and FUNCTION_TEST_BEGIN() are not both used in a single function by declaring the */ \
364+
/* same variable that FUNCTION_LOG_BEGIN() uses to track logging */ \
365365
LogLevel FUNCTION_LOG_LEVEL(); \
366366
(void)FUNCTION_LOG_LEVEL(); \
367367
\
368-
/* Ensure that FUNCTION_TEST_RETURN*() is not used with FUNCTION_LOG_BEGIN*() by declaring a variable that will be */ \
369-
/* referenced in FUNCTION_TEST_RETURN*() */ \
368+
/* Ensure that FUNCTION_TEST_RETURN*() is not used with FUNCTION_LOG_BEGIN*() by declaring a variable that will be */ \
369+
/* referenced in FUNCTION_TEST_RETURN*() */ \
370370
bool FUNCTION_TEST_BEGIN_exists; \
371371
\
372372
if (stackTraceTest()) \

src/config/parse.auto.c.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5519,7 +5519,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
55195519
), // opt/repo-azure-key-type
55205520
// opt/repo-azure-key-type
55215521
PARSE_RULE_OPTIONAL_ALLOW_LIST // opt/repo-azure-key-type
5522-
(
5522+
( // opt/repo-azure-key-type
55235523
PARSE_RULE_VAL_STRID(Auto), // opt/repo-azure-key-type
55245524
PARSE_RULE_VAL_STRID(Shared), // opt/repo-azure-key-type
55255525
PARSE_RULE_VAL_STRID(Sas), // opt/repo-azure-key-type
@@ -11712,6 +11712,7 @@ static const uint8_t optionResolveOrder[] =
1171211712
cfgOptRepoAzureAccount, // opt-resolve-order
1171311713
cfgOptRepoAzureContainer, // opt-resolve-order
1171411714
cfgOptRepoAzureEndpoint, // opt-resolve-order
11715+
cfgOptRepoAzureKey, // opt-resolve-order
1171511716
cfgOptRepoAzureKeyType, // opt-resolve-order
1171611717
cfgOptRepoAzureUriStyle, // opt-resolve-order
1171711718
cfgOptRepoBlock, // opt-resolve-order
@@ -11765,7 +11766,6 @@ static const uint8_t optionResolveOrder[] =
1176511766
cfgOptPgHostCmd, // opt-resolve-order
1176611767
cfgOptPgHostKeyFile, // opt-resolve-order
1176711768
cfgOptPgHostPort, // opt-resolve-order
11768-
cfgOptRepoAzureKey, // opt-resolve-order
1176911769
cfgOptRepoGcsBucket, // opt-resolve-order
1177011770
cfgOptRepoGcsEndpoint, // opt-resolve-order
1177111771
cfgOptRepoGcsKey, // opt-resolve-order

src/config/parse.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2787,7 +2787,8 @@ cfgParse(const Storage *const storage, const unsigned int argListSize, const cha
27872787
if ((!configOptionValue->set && !parseOptionValue->negate) || config->help)
27882788
{
27892789
// If the option has a default, only apply it if the dependency is valid
2790-
// If dependency is invalid, don't apply defaults as they may cause dependent options to be incorrectly required
2790+
// If dependency is invalid, don't apply defaults as they may cause dependent options to be incorrectly
2791+
// required
27912792
if (cfgParseOptionalRule(&optionalRules, parseRuleOptionalTypeDefault, config->command, optionId) &&
27922793
(dependResult.dependId == 0 || dependResult.valid))
27932794
{

src/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ main(int argListSize, const char *argList[])
110110
{
111111
// Annotate command
112112
// -----------------------------------------------------------------------------------------------------------------
113-
case cfgCmdAnnotate:
114-
cmdAnnotate();
113+
case cfgCmdAnnotate :
114+
cmdAnnotate();
115115
break;
116116

117117
// Archive get command

src/postgres/interface/page.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,12 @@ pgPageChecksum(uint8_t *const page, const uint32_t blockNo, const PgPageSize pag
7979
// Main checksum calculation
8080
switch (pageSize)
8181
{
82-
CHECKSUM_CASE(pgPageSize8); // Default page size should be checked first
83-
CHECKSUM_CASE(pgPageSize1);
84-
CHECKSUM_CASE(pgPageSize2);
85-
CHECKSUM_CASE(pgPageSize4);
86-
CHECKSUM_CASE(pgPageSize16);
87-
CHECKSUM_CASE(pgPageSize32);
82+
CHECKSUM_CASE(pgPageSize8); // Default page size should be checked first
83+
CHECKSUM_CASE(pgPageSize1);
84+
CHECKSUM_CASE(pgPageSize2);
85+
CHECKSUM_CASE(pgPageSize4);
86+
CHECKSUM_CASE(pgPageSize16);
87+
CHECKSUM_CASE(pgPageSize32);
8888

8989
default:
9090
pgPageSizeCheck(pageSize);

src/storage/azure/storage.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,8 @@ storageAzureAuth(
218218
httpQueryAdd(authQuery, AZURE_QUERY_RESOURCE, strNewFmt("https://%s", strZ(this->host)));
219219

220220
HttpRequest *const request = httpRequestNewP(
221-
this->credHttpClient, HTTP_VERB_GET_STR, STRDEF(AZURE_CREDENTIAL_PATH), .header = authHeader, .query = authQuery);
221+
this->credHttpClient, HTTP_VERB_GET_STR, STRDEF(AZURE_CREDENTIAL_PATH), .header = authHeader,
222+
.query = authQuery);
222223
HttpResponse *const response = httpRequestResponse(request, true);
223224

224225
// Set the access_token on success and store an expiration time when we should re-fetch it

0 commit comments

Comments
 (0)