Skip to content

Commit 21cb81e

Browse files
committed
Provide an option to disable writing developer certificate to cloud_credentials.c
1 parent 400fd82 commit 21cb81e

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

tools/device_management.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ def __init__(self, *args, **kwargs):
5151
"Create or transform a manifest. "
5252
"Use {} [command] -h for help on each command."
5353
).format(self.parser.prog)
54+
subparserActionLength = len(self.parser._subparsers._actions)
55+
initParser = self.parser._subparsers._actions[subparserActionLength-1].choices['init']
56+
initParser.add_argument('--disable-cert', help='Disable writing the developer certificate to mbed_cloud_dev_credentials.c')
5457

5558
def _addCreateArgs(self, parser, exclusions=[]):
5659
if 'payload' not in exclusions:
@@ -131,10 +134,14 @@ def inner(options):
131134
"mbed-cli-auto {}".format(api_key.name),
132135
description="cetificate auto-generated by Mbed CLI"
133136
)
134-
LOG.info("Writing developer certificate %s into c file "
137+
if getattr(options, 'disable_cert'):
138+
LOG.warning("Developer certificate %s not written to "
139+
"mbed_cloud_dev_credentials.c", dev_cert_info.name)
140+
else:
141+
LOG.info("Writing developer certificate %s into c file "
135142
"mbed_cloud_dev_credentials.c", dev_cert_info.name)
136-
with open("mbed_cloud_dev_credentials.c", "w") as fout:
137-
fout.write(dev_cert_info.header_file)
143+
with open("mbed_cloud_dev_credentials.c", "w") as fout:
144+
fout.write(dev_cert_info.header_file)
138145
return func(options)
139146
return inner
140147

0 commit comments

Comments
 (0)