Skip to content

Commit 6ba6142

Browse files
committed
Remove unnecesary validations
Signed-off-by: Pascal Hernandez <pascal.hernandez@nordicsemi.no>
1 parent 7dd9d81 commit 6ba6142

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

src/nrfcredstore/cli.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,6 @@ def exec_cmd(args, credstore):
8989
ct = CredType[args.type]
9090
if credstore.delete(args.tag, ct):
9191
print(f'{ct.name} in secure tag {args.tag} deleted')
92-
else:
93-
raise RuntimeError('delete failed')
9492
elif args.subcommand=='generate':
9593
credstore.keygen(args.tag, args.file, args.attributes)
9694
print(f'New private key generated in secure tag {args.tag}')

src/nrfcredstore/credstore.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ def __init__(self, tag: int, type: int, sha: str):
2626
self.type = CredType(type)
2727
self.sha = sha
2828

29-
def is_ok(response_lines):
30-
return not any("ERROR" in line for line in response_lines)
31-
3229
class CredStore:
3330
def __init__(self, at_client):
3431
self.at_client = at_client
@@ -80,7 +77,7 @@ def write(self, tag: int, type: CredType, file: io.TextIOBase):
8077
if type == CredType.ANY:
8178
raise ValueError
8279
cert = file.read().rstrip()
83-
return is_ok(self.at_client.at_command(f'AT%CMNG=0,{tag},{type.value},"{cert}"'))
80+
return self.at_client.at_command(f'AT%CMNG=0,{tag},{type.value},"{cert}"')
8481

8582
def delete(self, tag: int, type: CredType):
8683
"""Delete a credential from the modem
@@ -90,7 +87,7 @@ def delete(self, tag: int, type: CredType):
9087

9188
if type == CredType.ANY:
9289
raise ValueError
93-
return is_ok(self.at_client.at_command(f'AT%CMNG=3,{tag},{type.value}'))
90+
return self.at_client.at_command(f'AT%CMNG=3,{tag},{type.value}')
9491

9592
def keygen(self, tag: int, file: io.BufferedIOBase, attributes: str = ''):
9693
"""Generate a new private key and return a certificate signing request in DER format"""

0 commit comments

Comments
 (0)