Skip to content

Commit c123b98

Browse files
authored
Merge pull request #9804 from aashishc1988/disable_update_cert
Provide an option to disable writing developer certificate
2 parents a59d45f + 294bb3a commit c123b98

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

tools/device_management.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ 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+
for initIndex in range(len(self.parser._subparsers._actions)):
55+
try:
56+
if 'init' in (self.parser._subparsers._actions[initIndex]).choices:
57+
initParser = self.parser._subparsers._actions[initIndex].choices['init']
58+
except TypeError:
59+
pass
60+
initParser.add_argument('--no-developer-cert', help='Do not download the developer certificate')
5461

5562
def _addCreateArgs(self, parser, exclusions=[]):
5663
if 'payload' not in exclusions:
@@ -131,10 +138,13 @@ def inner(options):
131138
"mbed-cli-auto {}".format(api_key.name),
132139
description="cetificate auto-generated by Mbed CLI"
133140
)
134-
LOG.info("Writing developer certificate %s into c file "
141+
if getattr(options, 'no_developer_cert'):
142+
LOG.info("Skipping download of developer certificate")
143+
else:
144+
LOG.info("Writing developer certificate %s into c file "
135145
"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)
146+
with open("mbed_cloud_dev_credentials.c", "w") as fout:
147+
fout.write(dev_cert_info.header_file)
138148
return func(options)
139149
return inner
140150

0 commit comments

Comments
 (0)