MCPcopy Create free account
hub / github.com/canonical/cloud-init / main

Function main

cloudinit/sources/DataSourceMAAS.py:326–462  ·  view source on GitHub ↗

Call with single argument of directory or http or https url. If url is given additional arguments are allowed, which will be interpreted as consumer_key, token_key, token_secret, consumer_secret

()

Source from the content-addressed store, hash-verified

324if __name__ == "__main__":
325
326 def main():
327 """
328 Call with single argument of directory or http or https url.
329 If url is given additional arguments are allowed, which will be
330 interpreted as consumer_key, token_key, token_secret, consumer_secret
331 """
332 import argparse
333 import pprint
334 import sys
335
336 parser = argparse.ArgumentParser(description="Interact with MAAS DS")
337 parser.add_argument(
338 "--config",
339 metavar="file",
340 help="specify DS config file",
341 default=None,
342 )
343 parser.add_argument(
344 "--ckey",
345 metavar="key",
346 help="the consumer key to auth with",
347 default=None,
348 )
349 parser.add_argument(
350 "--tkey",
351 metavar="key",
352 help="the token key to auth with",
353 default=None,
354 )
355 parser.add_argument(
356 "--csec",
357 metavar="secret",
358 help="the consumer secret (likely '')",
359 default="",
360 )
361 parser.add_argument(
362 "--tsec",
363 metavar="secret",
364 help="the token secret to auth with",
365 default=None,
366 )
367 parser.add_argument(
368 "--apiver",
369 metavar="version",
370 help="the apiver to use ( can be used)",
371 default=MD_VERSION,
372 )
373
374 subcmds = parser.add_subparsers(title="subcommands", dest="subcmd")
375 for name, help in (
376 ("crawl", "crawl the datasource"),
377 ("get", "do a single GET of provided url"),
378 ("check-seed", "read and verify seed at url"),
379 ):
380 p = subcmds.add_parser(name, help=help)
381 p.add_argument(
382 "url", help="the datasource url", nargs="?", default=None
383 )

Callers 1

DataSourceMAAS.pyFile · 0.70

Calls 8

get_oauth_helperFunction · 0.85
read_maas_seed_dirFunction · 0.85
read_maas_seed_urlFunction · 0.85
printurlFunction · 0.85
crawlFunction · 0.85
parse_argsMethod · 0.80
writeMethod · 0.80
existsMethod · 0.45

Tested by

no test coverage detected