Skip to content
This repository was archived by the owner on Feb 8, 2024. It is now read-only.

Commit 81d7a1d

Browse files
author
Tanuja Shinde
committed
CORTX-33673: updated lock unlock interfaces
Signed-off-by: Tanuja Shinde <[email protected]>
2 parents 2370063 + c65a619 commit 81d7a1d

File tree

2 files changed

+26
-5
lines changed

2 files changed

+26
-5
lines changed

.github/auto_assign.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Set to true to add reviewers to pull requests
2+
addReviewers: true
3+
4+
# Set to true to add assignees to pull requests
5+
addAssignees: true
6+
7+
# A list of reviewers to be added to pull requests (GitHub user name)
8+
reviewers:
9+
- sachinpunadikar
10+
- ujjwalpl
11+
- cdeshmukh
12+
13+
# A list of keywords to be skipped the process that add reviewers if pull requests include it
14+
skipKeywords:
15+
- wip
16+
17+
# A number of reviewers added to the pull request
18+
# Set 0 to add all the reviewers (default: 0)
19+
numberOfReviewers: 0

py-utils/src/utils/conf_store/conf_store.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -291,9 +291,11 @@ def lock(self, index: str, **kwargs):
291291
index)
292292

293293
allowed_keys = { 'domain', 'owner', 'duration' }
294-
for key in kwargs.keys():
294+
for key, val in kwargs.items():
295295
if key not in allowed_keys:
296296
raise ConfError(errno.EINVAL, "Invalid parameter %s", key)
297+
if key == 'duration' and not isinstance(val, int):
298+
raise ConfError(errno.EINVAL, "Invalid value %s for parameter %s", val, key)
297299

298300
owner = self._lock_owner if 'owner' not in kwargs.keys() else kwargs['owner']
299301
domain = self._lock_domain if 'domain' not in kwargs.keys() else kwargs['domain']
@@ -330,11 +332,11 @@ def unlock(self, index: str, **kwargs):
330332

331333
force = False
332334
allowed_keys = { 'domain', 'owner', 'force' }
333-
for key in kwargs.keys():
335+
for key, val in kwargs.items():
334336
if key not in allowed_keys:
335337
raise ConfError(errno.EINVAL, "Invalid parameter %s", key)
336-
if key == 'force' and not isinstance(kwargs['force'], bool):
337-
raise ConfError(errno.EINVAL, "Invalid value %s for parameter %s", kwargs['force'], key)
338+
if key == 'force' and not isinstance(val, bool):
339+
raise ConfError(errno.EINVAL, "Invalid value %s for parameter %s", val, key)
338340

339341
owner = self._lock_owner if 'owner' not in kwargs.keys() else kwargs['owner']
340342
domain = self._lock_domain if 'domain' not in kwargs.keys() else kwargs['domain']
@@ -362,7 +364,7 @@ def test_lock(self, index: str, **kwargs):
362364
index)
363365

364366
allowed_keys = { 'domain' , 'owner'}
365-
for key in kwargs.keys():
367+
for key, _ in kwargs.items():
366368
if key not in allowed_keys:
367369
raise ConfError(errno.EINVAL, "Invalid parameter %s", key)
368370

0 commit comments

Comments
 (0)