Advertisement
celeste_ath

Untitled

Jun 10th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.16 KB | None | 0 0
  1. diff --git a/virt-install b/virt-install
  2. index e0659a40..44a5c879 100755
  3. --- a/virt-install
  4. +++ b/virt-install
  5. @@ -368,6 +368,9 @@ def check_option_collisions(options, guest, installer):
  6. if options.initrd_inject or options.extra_args:
  7. fail(_("--unattended does not support --initrd-inject nor --extra-args."))
  8.  
  9. + if options.install:
  10. + pass
  11. +
  12.  
  13. def _show_nographics_warnings(options, guest, installer):
  14. if guest.devices.graphics:
  15. @@ -816,6 +819,8 @@ def parse_args():
  16. help=_("Add given file to root of initrd from --location"))
  17. insg.add_argument("--unattended",
  18. help=_("Perform a unattended installation"))
  19. + insg.add_argument("--install",
  20. + help=_("Perform cloud image installation with cloud-init configuration"))
  21.  
  22. # Takes a URL and just prints to stdout the detected distro name
  23. insg.add_argument("--test-media-detection", help=argparse.SUPPRESS)
  24. diff --git a/virtinst/cli.py b/virtinst/cli.py
  25. index 7ba6b211..05841565 100644
  26. --- a/virtinst/cli.py
  27. +++ b/virtinst/cli.py
  28. @@ -28,6 +28,7 @@ from .devices import (Device, DeviceController, DeviceDisk, DeviceGraphics,
  29. from .nodedev import NodeDevice
  30. from .storage import StoragePool, StorageVolume
  31. from .unattended import UnattendedData
  32. +from .cloud import CloudInit
  33.  
  34.  
  35. ##########################
  36. @@ -463,7 +464,7 @@ def get_meter():
  37.  
  38. def _get_completer_parsers():
  39. return VIRT_PARSERS + [ParserCheck, ParserLocation, ParserOSVariant,
  40. - ParserUnattended]
  41. + ParserUnattended, ParserCloudInit]
  42.  
  43.  
  44. def _virtparser_completer(prefix, **kwargs):
  45. @@ -1512,6 +1513,25 @@ def parse_unattended(optstr):
  46. return ret
  47.  
  48. +########################
  49. +# --cloud-init parsing #
  50. +########################
  51. +
  52. +class ParserCloudInit(VirtCLIParser):
  53. + cli_arg_name = "install"
  54. +
  55. + @classmethod
  56. + def _init_class(cls, **kwargs):
  57. + VirtCLIParser._init_class(**kwargs)
  58. + cls.add_arg("is.cloud", "is_cloud")
  59. +
  60. +def parse_install(optstr):
  61. + ret = CloudInit()
  62. + parser = ParserCloudInit(optstr)
  63. + parser.parse(ret)
  64. + return ret
  65. +
  66. +
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement