Skip to content

Commit 74493a8

Browse files
committed
Fix --with-testbed option in parsec sequester CLI when the testbed template needs to create blocks
1 parent e1f894e commit 74493a8

4 files changed

Lines changed: 44 additions & 8 deletions

File tree

server/parsec/cli/inspect.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@
1717
from parsec.cli.utils import cli_exception_handler, start_backend
1818
from parsec.components.realm import RealmGrantedRole
1919
from parsec.components.user import UserDump
20-
from parsec.config import BaseDatabaseConfig, DisabledBlockStoreConfig, LogLevel
20+
from parsec.config import (
21+
BaseDatabaseConfig,
22+
DisabledBlockStoreConfig,
23+
LogLevel,
24+
MockedBlockStoreConfig,
25+
)
2126

2227

2328
class DevOption(click.Option):
@@ -93,7 +98,11 @@ async def _human_accesses(
9398
user_filter: str,
9499
) -> None:
95100
# Can use a dummy blockstore config since we are not going to query it
96-
blockstore_config = DisabledBlockStoreConfig()
101+
if with_testbed is None:
102+
blockstore_config = DisabledBlockStoreConfig()
103+
else:
104+
# Testbed template might need to create some blocks
105+
blockstore_config = MockedBlockStoreConfig()
97106

98107
async with start_backend(
99108
db_config=db_config,

server/parsec/cli/sequester_create.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,12 @@
3030
SequesterServiceConfig,
3131
SequesterServiceType,
3232
)
33-
from parsec.config import BaseDatabaseConfig, DisabledBlockStoreConfig, LogLevel
33+
from parsec.config import (
34+
BaseDatabaseConfig,
35+
DisabledBlockStoreConfig,
36+
LogLevel,
37+
MockedBlockStoreConfig,
38+
)
3439

3540
SEQUESTER_SERVICE_CERTIFICATE_PEM_HEADER = "-----BEGIN PARSEC SEQUESTER SERVICE CERTIFICATE-----"
3641
SEQUESTER_SERVICE_CERTIFICATE_PEM_FOOTER = "-----END PARSEC SEQUESTER SERVICE CERTIFICATE-----"
@@ -322,7 +327,11 @@ async def _create_service(
322327
sequester_service_config: SequesterServiceConfig,
323328
) -> None:
324329
# Can use a dummy blockstore config since we are not going to query it
325-
blockstore_config = DisabledBlockStoreConfig()
330+
if with_testbed is None:
331+
blockstore_config = DisabledBlockStoreConfig()
332+
else:
333+
# Testbed template might need to create some blocks
334+
blockstore_config = MockedBlockStoreConfig()
326335

327336
async with start_backend(
328337
db_config=db_config,

server/parsec/cli/sequester_list.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@
1717
SequesterGetOrganizationServicesBadOutcome,
1818
WebhookSequesterService,
1919
)
20-
from parsec.config import BaseDatabaseConfig, DisabledBlockStoreConfig, LogLevel
20+
from parsec.config import (
21+
BaseDatabaseConfig,
22+
DisabledBlockStoreConfig,
23+
LogLevel,
24+
MockedBlockStoreConfig,
25+
)
2126

2227

2328
class DevOption(click.Option):
@@ -102,7 +107,11 @@ async def _list_services(
102107
organization_id: OrganizationID,
103108
) -> None:
104109
# Can use a dummy blockstore config since we are not going to query it
105-
blockstore_config = DisabledBlockStoreConfig()
110+
if with_testbed is None:
111+
blockstore_config = DisabledBlockStoreConfig()
112+
else:
113+
# Testbed template might need to create some blocks
114+
blockstore_config = MockedBlockStoreConfig()
106115

107116
async with start_backend(
108117
db_config=db_config,

server/parsec/cli/sequester_revoke.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@
2727
SequesterRevokeServiceStoreBadOutcome,
2828
SequesterRevokeServiceValidateBadOutcome,
2929
)
30-
from parsec.config import BaseDatabaseConfig, DisabledBlockStoreConfig, LogLevel
30+
from parsec.config import (
31+
BaseDatabaseConfig,
32+
DisabledBlockStoreConfig,
33+
LogLevel,
34+
MockedBlockStoreConfig,
35+
)
3136

3237
SEQUESTER_SERVICE_REVOCATION_CERTIFICATE_PEM_HEADER = (
3338
"-----BEGIN PARSEC SEQUESTER SERVICE REVOCATION CERTIFICATE-----"
@@ -280,7 +285,11 @@ async def _revoke_service(
280285
service_revocation_certificate_pem: str,
281286
) -> None:
282287
# Can use a dummy blockstore config since we are not going to query it
283-
blockstore_config = DisabledBlockStoreConfig()
288+
if with_testbed is None:
289+
blockstore_config = DisabledBlockStoreConfig()
290+
else:
291+
# Testbed template might need to create some blocks
292+
blockstore_config = MockedBlockStoreConfig()
284293

285294
async with start_backend(
286295
db_config=db_config,

0 commit comments

Comments
 (0)