zbuilder 0.1.0__tar.gz → 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. {zbuilder-0.1.0 → zbuilder-0.2.0}/PKG-INFO +45 -20
  2. zbuilder-0.2.0/README.md +67 -0
  3. {zbuilder-0.1.0 → zbuilder-0.2.0}/pyproject.toml +18 -19
  4. {zbuilder-0.1.0 → zbuilder-0.2.0}/pyproject.toml.orig +33 -19
  5. {zbuilder-0.1.0 → zbuilder-0.2.0}/src/zbuilder/cli.py +2 -2
  6. {zbuilder-0.1.0 → zbuilder-0.2.0}/src/zbuilder/dns/gcp.py +13 -2
  7. {zbuilder-0.1.0 → zbuilder-0.2.0}/src/zbuilder/vm/gcp.py +26 -4
  8. zbuilder-0.2.0/src/zbuilder/vm/kvm.py +753 -0
  9. {zbuilder-0.1.0 → zbuilder-0.2.0}/src/zbuilder/vm/proxmox.py +31 -1
  10. zbuilder-0.1.0/README.md +0 -40
  11. zbuilder-0.1.0/src/zbuilder/dns/azure.py +0 -55
  12. zbuilder-0.1.0/src/zbuilder/dns/do.py +0 -45
  13. zbuilder-0.1.0/src/zbuilder/dns/vagrant.py +0 -9
  14. zbuilder-0.1.0/src/zbuilder/vm/azure.py +0 -252
  15. zbuilder-0.1.0/src/zbuilder/vm/do.py +0 -181
  16. zbuilder-0.1.0/src/zbuilder/vm/ganeti.py +0 -175
  17. zbuilder-0.1.0/src/zbuilder/vm/vagrant.py +0 -191
  18. {zbuilder-0.1.0 → zbuilder-0.2.0}/LICENSE +0 -0
  19. {zbuilder-0.1.0 → zbuilder-0.2.0}/src/zbuilder/__init__.py +0 -0
  20. {zbuilder-0.1.0 → zbuilder-0.2.0}/src/zbuilder/base.py +0 -0
  21. {zbuilder-0.1.0 → zbuilder-0.2.0}/src/zbuilder/cfg.py +0 -0
  22. {zbuilder-0.1.0 → zbuilder-0.2.0}/src/zbuilder/dns/__init__.py +0 -0
  23. {zbuilder-0.1.0 → zbuilder-0.2.0}/src/zbuilder/dns/ansible.py +0 -0
  24. {zbuilder-0.1.0 → zbuilder-0.2.0}/src/zbuilder/dns/aws.py +0 -0
  25. {zbuilder-0.1.0 → zbuilder-0.2.0}/src/zbuilder/dns/bind.py +0 -0
  26. {zbuilder-0.1.0 → zbuilder-0.2.0}/src/zbuilder/dns/powerdns.py +0 -0
  27. {zbuilder-0.1.0 → zbuilder-0.2.0}/src/zbuilder/helpers.py +0 -0
  28. {zbuilder-0.1.0 → zbuilder-0.2.0}/src/zbuilder/ipam/__init__.py +0 -0
  29. {zbuilder-0.1.0 → zbuilder-0.2.0}/src/zbuilder/ipam/phpipam.py +0 -0
  30. {zbuilder-0.1.0 → zbuilder-0.2.0}/src/zbuilder/options.py +0 -0
  31. {zbuilder-0.1.0 → zbuilder-0.2.0}/src/zbuilder/plugins.py +0 -0
  32. {zbuilder-0.1.0 → zbuilder-0.2.0}/src/zbuilder/vm/__init__.py +0 -0
  33. {zbuilder-0.1.0 → zbuilder-0.2.0}/src/zbuilder/vm/aws.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: zbuilder
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: Create VMs
5
5
  Author: Nikos Chasiotis
6
6
  Author-email: Nikos Chasiotis <hasiotis@gmail.com>
@@ -23,25 +23,23 @@ Requires-Dist: arrow>=1.1,<2
23
23
  Requires-Dist: pyjwt>=2.5.0,<3
24
24
  Requires-Dist: dpath>=2.0,<3
25
25
  Requires-Dist: dnspython>=2,<3
26
- Requires-Dist: google-auth-oauthlib>=0.4,<1.5
27
- Requires-Dist: oauthlib>=3.2.1,<4
28
- Requires-Dist: azure-mgmt-resource>=18.0,<27
29
- Requires-Dist: azure-mgmt-network>=19.0,<33
30
- Requires-Dist: azure-mgmt-compute>=21.0,<39
31
- Requires-Dist: azure-mgmt-dns>=8.0,<10
32
- Requires-Dist: azure-identity>=1.12,<2
33
- Requires-Dist: python-digitalocean>=1.16,<2
34
- Requires-Dist: proxmoxer>=1.1,<3
35
26
  Requires-Dist: ansible>=14.3.1,<15
36
- Requires-Dist: google-api-python-client>=2.198.0,<3
37
- Requires-Dist: google-cloud-dns>=0.37.0,<0.38
38
27
  Requires-Dist: setuptools>=84.0.0,<85
39
28
  Requires-Dist: massedit>=0.71.0
40
29
  Requires-Dist: ruamel-yaml>=0.19.1
41
30
  Requires-Dist: boto3>=1.43.73
42
31
  Requires-Dist: tabulate>=0.10.0
32
+ Requires-Dist: libvirt-python>=11,<12
33
+ Requires-Dist: pycdlib>=1.14,<2
34
+ Requires-Dist: google-auth-oauthlib>=0.4,<1.5 ; extra == 'gcp'
35
+ Requires-Dist: oauthlib>=3.2.1,<4 ; extra == 'gcp'
36
+ Requires-Dist: google-api-python-client>=2.198.0,<3 ; extra == 'gcp'
37
+ Requires-Dist: google-cloud-dns>=0.37.0,<0.38 ; extra == 'gcp'
38
+ Requires-Dist: proxmoxer>=1.1,<3 ; extra == 'proxmox'
43
39
  Requires-Python: >=3.12, <4
44
40
  Project-URL: Repository, https://github.com/hasiotis/zbuilder
41
+ Provides-Extra: gcp
42
+ Provides-Extra: proxmox
45
43
  Description-Content-Type: text/markdown
46
44
 
47
45
  # Zbuilder: Building VMs and applying ansible playbooks
@@ -49,19 +47,22 @@ Description-Content-Type: text/markdown
49
47
  [![PyPi version](https://badge.fury.io/py/zbuilder.svg)](https://pypi.org/project/zbuilder/)
50
48
  [![PyPi downloads](https://img.shields.io/pypi/dm/zbuilder.svg)](https://pypistats.org/packages/zbuilder)
51
49
  [![Build status](https://github.com/hasiotis/zbuilder/workflows/master/badge.svg)](https://github.com/hasiotis/zbuilder/actions?query=workflow%3A%22master%22)
52
- [![Documentation Status](https://readthedocs.org/projects/zbuilder/badge/?version=stable)](https://zbuilder.readthedocs.io/en/develop/?badge=develop)
50
+ [![Documentation Status](https://readthedocs.org/projects/zbuilder/badge/?version=stable)](https://zbuilder.readthedocs.io/en/stable/?badge=stable)
53
51
  [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://github.com/hasiotis/zbuilder/blob/master/LICENSE)
54
52
 
55
- ZBuilder is a tool to help you build VMs ready to be transfered to ansible.
53
+ ZBuilder is a tool to help you build VMs ready to be transferred to ansible.
56
54
  By using ansible as a library, it has access to all ansible variables. This
57
55
  way it achieves high integration with ansible.
58
56
 
59
57
  ## Installation
60
58
 
59
+ zbuilder depends on the libvirt python bindings, which compile against the
60
+ libvirt headers, so install those first:
61
+ ```
62
+ apt install libvirt-dev pkg-config gcc # or: dnf install libvirt-devel
63
+ ```
61
64
 
62
- ## Installation
63
-
64
- Install with:
65
+ Then install with:
65
66
  ```
66
67
  pipx install --force zbuilder
67
68
  ```
@@ -72,15 +73,39 @@ or
72
73
  pip3 install --user --upgrade zbuilder
73
74
  ```
74
75
 
76
+ The `gcp` provider needs the google client libraries, which ship as an extra:
77
+ ```
78
+ pipx install --force 'zbuilder[gcp]'
79
+ ```
80
+
81
+ The `proxmox` provider needs `proxmoxer`, which ships as an extra:
82
+ ```
83
+ pipx install --force 'zbuilder[proxmox]'
84
+ ```
85
+
86
+ ## Providers
87
+
88
+ | Family | Providers |
89
+ |---|---|
90
+ | VM | `aws`, `gcp`, `kvm`, `proxmox` |
91
+ | DNS | `ansible`, `aws`, `bind`, `gcp`, `powerdns` |
92
+ | IPAM | `phpipam` |
93
+
94
+ See the [documentation](https://zbuilder.readthedocs.io/en/stable/) for the
95
+ settings each one accepts, or run `zbuilder providers`.
96
+
75
97
  ## Development
76
98
  During development you can:
77
99
  ```
78
100
  uv sync
79
101
  . .venv/bin/activate
102
+
103
+ uv run pytest # run the tests
104
+ prek run --all-files # lint and format
80
105
  ```
81
106
 
82
107
  ## Links
83
108
 
84
- * [Documentation](https://zbuilder.readthedocs.io/en/stable/?badge=stable)
85
- * [Releases](https://pypi.org/project/zbuilder/)
86
- * [Code](https://github.com/hasiotis/zbuilder)
109
+ [Documentation](https://zbuilder.readthedocs.io/en/stable/?badge=stable)
110
+ | [Releases](https://pypi.org/project/zbuilder/)
111
+ | [Code](https://github.com/hasiotis/zbuilder)
@@ -0,0 +1,67 @@
1
+ # Zbuilder: Building VMs and applying ansible playbooks
2
+
3
+ [![PyPi version](https://badge.fury.io/py/zbuilder.svg)](https://pypi.org/project/zbuilder/)
4
+ [![PyPi downloads](https://img.shields.io/pypi/dm/zbuilder.svg)](https://pypistats.org/packages/zbuilder)
5
+ [![Build status](https://github.com/hasiotis/zbuilder/workflows/master/badge.svg)](https://github.com/hasiotis/zbuilder/actions?query=workflow%3A%22master%22)
6
+ [![Documentation Status](https://readthedocs.org/projects/zbuilder/badge/?version=stable)](https://zbuilder.readthedocs.io/en/stable/?badge=stable)
7
+ [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://github.com/hasiotis/zbuilder/blob/master/LICENSE)
8
+
9
+ ZBuilder is a tool to help you build VMs ready to be transferred to ansible.
10
+ By using ansible as a library, it has access to all ansible variables. This
11
+ way it achieves high integration with ansible.
12
+
13
+ ## Installation
14
+
15
+ zbuilder depends on the libvirt python bindings, which compile against the
16
+ libvirt headers, so install those first:
17
+ ```
18
+ apt install libvirt-dev pkg-config gcc # or: dnf install libvirt-devel
19
+ ```
20
+
21
+ Then install with:
22
+ ```
23
+ pipx install --force zbuilder
24
+ ```
25
+
26
+ or
27
+
28
+ ```
29
+ pip3 install --user --upgrade zbuilder
30
+ ```
31
+
32
+ The `gcp` provider needs the google client libraries, which ship as an extra:
33
+ ```
34
+ pipx install --force 'zbuilder[gcp]'
35
+ ```
36
+
37
+ The `proxmox` provider needs `proxmoxer`, which ships as an extra:
38
+ ```
39
+ pipx install --force 'zbuilder[proxmox]'
40
+ ```
41
+
42
+ ## Providers
43
+
44
+ | Family | Providers |
45
+ |---|---|
46
+ | VM | `aws`, `gcp`, `kvm`, `proxmox` |
47
+ | DNS | `ansible`, `aws`, `bind`, `gcp`, `powerdns` |
48
+ | IPAM | `phpipam` |
49
+
50
+ See the [documentation](https://zbuilder.readthedocs.io/en/stable/) for the
51
+ settings each one accepts, or run `zbuilder providers`.
52
+
53
+ ## Development
54
+ During development you can:
55
+ ```
56
+ uv sync
57
+ . .venv/bin/activate
58
+
59
+ uv run pytest # run the tests
60
+ prek run --all-files # lint and format
61
+ ```
62
+
63
+ ## Links
64
+
65
+ [Documentation](https://zbuilder.readthedocs.io/en/stable/?badge=stable)
66
+ | [Releases](https://pypi.org/project/zbuilder/)
67
+ | [Code](https://github.com/hasiotis/zbuilder)
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "zbuilder"
3
- version = "0.1.0"
3
+ version = "0.2.0"
4
4
  description = "Create VMs"
5
5
  license = "GPL-3.0-or-later"
6
6
  license-files = ["LICENSE"]
@@ -26,29 +26,29 @@ dependencies = [
26
26
  "PyJWT>=2.5.0,<3",
27
27
  "dpath>=2.0,<3",
28
28
  "dnspython>=2,<3",
29
- "google-auth-oauthlib>=0.4,<1.5",
30
- "oauthlib>=3.2.1,<4",
31
- "azure-mgmt-resource>=18.0,<27",
32
- "azure-mgmt-network>=19.0,<33",
33
- "azure-mgmt-compute>=21.0,<39",
34
- "azure-mgmt-dns>=8.0,<10",
35
- "azure-identity>=1.12,<2",
36
- "python-digitalocean>=1.16,<2",
37
- "proxmoxer>=1.1,<3",
38
29
  "ansible>=14.3.1,<15",
39
- "google-api-python-client>=2.198.0,<3",
40
- "google-cloud-dns>=0.37.0,<0.38",
41
30
  "setuptools>=84.0.0,<85",
42
31
  "massedit>=0.71.0",
43
32
  "ruamel-yaml>=0.19.1",
44
33
  "boto3>=1.43.73",
45
34
  "tabulate>=0.10.0",
35
+ "libvirt-python>=11,<12",
36
+ "pycdlib>=1.14,<2",
46
37
  ]
47
38
 
48
39
  [[project.authors]]
49
40
  name = "Nikos Chasiotis"
50
41
  email = "hasiotis@gmail.com"
51
42
 
43
+ [project.optional-dependencies]
44
+ gcp = [
45
+ "google-auth-oauthlib>=0.4,<1.5",
46
+ "oauthlib>=3.2.1,<4",
47
+ "google-api-python-client>=2.198.0,<3",
48
+ "google-cloud-dns>=0.37.0,<0.38",
49
+ ]
50
+ proxmox = ["proxmoxer>=1.1,<3"]
51
+
52
52
  [project.urls]
53
53
  Repository = "https://github.com/hasiotis/zbuilder"
54
54
 
@@ -57,22 +57,16 @@ zbuilder = "zbuilder.cli:cli"
57
57
 
58
58
  [project.entry-points."zbuilder.vm"]
59
59
  aws = "zbuilder.vm.aws:vmProvider"
60
- azure = "zbuilder.vm.azure:vmProvider"
61
- do = "zbuilder.vm.do:vmProvider"
62
- ganeti = "zbuilder.vm.ganeti:vmProvider"
63
60
  gcp = "zbuilder.vm.gcp:vmProvider"
61
+ kvm = "zbuilder.vm.kvm:vmProvider"
64
62
  proxmox = "zbuilder.vm.proxmox:vmProvider"
65
- vagrant = "zbuilder.vm.vagrant:vmProvider"
66
63
 
67
64
  [project.entry-points."zbuilder.dns"]
68
65
  ansible = "zbuilder.dns.ansible:dnsProvider"
69
66
  aws = "zbuilder.dns.aws:dnsProvider"
70
- azure = "zbuilder.dns.azure:dnsProvider"
71
67
  bind = "zbuilder.dns.bind:dnsProvider"
72
- do = "zbuilder.dns.do:dnsProvider"
73
68
  gcp = "zbuilder.dns.gcp:dnsProvider"
74
69
  powerdns = "zbuilder.dns.powerdns:dnsProvider"
75
- vagrant = "zbuilder.dns.vagrant:dnsProvider"
76
70
 
77
71
  [project.entry-points."zbuilder.ipam"]
78
72
  phpipam = "zbuilder.ipam.phpipam:ipamProvider"
@@ -87,6 +81,11 @@ docs = ["sphinx>=7.2.6,<8"]
87
81
  [tool.uv]
88
82
  default-groups = ["dev"]
89
83
 
84
+ [[tool.uv.dependency-metadata]]
85
+ name = "libvirt-python"
86
+ version = "11.10.0"
87
+ requires-dist = []
88
+
90
89
  [tool.ruff]
91
90
  line-length = 120
92
91
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "zbuilder"
3
- version = "0.1.0"
3
+ version = "0.2.0"
4
4
  description = "Create VMs"
5
5
  authors = [{ name = "Nikos Chasiotis", email = "hasiotis@gmail.com" }]
6
6
  license = "GPL-3.0-or-later"
@@ -27,23 +27,33 @@ dependencies = [
27
27
  "PyJWT>=2.5.0,<3",
28
28
  "dpath>=2.0,<3",
29
29
  "dnspython>=2,<3",
30
- "google-auth-oauthlib>=0.4,<1.5",
31
- "oauthlib>=3.2.1,<4",
32
- "azure-mgmt-resource>=18.0,<27",
33
- "azure-mgmt-network>=19.0,<33",
34
- "azure-mgmt-compute>=21.0,<39",
35
- "azure-mgmt-dns>=8.0,<10",
36
- "azure-identity>=1.12,<2",
37
- "python-digitalocean>=1.16,<2",
38
- "proxmoxer>=1.1,<3",
39
30
  "ansible>=14.3.1,<15",
40
- "google-api-python-client>=2.198.0,<3",
41
- "google-cloud-dns>=0.37.0,<0.38",
42
31
  "setuptools>=84.0.0,<85",
43
32
  "massedit>=0.71.0",
44
33
  "ruamel-yaml>=0.19.1",
45
34
  "boto3>=1.43.73",
46
35
  "tabulate>=0.10.0",
36
+ # The kvm provider. libvirt-python compiles against libvirt-dev, which has
37
+ # to be present before `uv sync` - see the dependency-metadata block below.
38
+ "libvirt-python>=11,<12",
39
+ "pycdlib>=1.14,<2",
40
+ ]
41
+
42
+ [project.optional-dependencies]
43
+ # The gcp providers (vm and dns) pull in the whole google client stack, which
44
+ # is a large dependency tree nobody outside GCP needs. zbuilder/vm/gcp.py and
45
+ # zbuilder/dns/gcp.py import it lazily and say what to install when missing.
46
+ gcp = [
47
+ "google-auth-oauthlib>=0.4,<1.5",
48
+ "oauthlib>=3.2.1,<4",
49
+ "google-api-python-client>=2.198.0,<3",
50
+ "google-cloud-dns>=0.37.0,<0.38",
51
+ ]
52
+ # The proxmox provider talks to PVE through proxmoxer, which nobody outside a
53
+ # proxmox cluster needs. zbuilder/vm/proxmox.py imports it lazily and says what
54
+ # to install when it is missing.
55
+ proxmox = [
56
+ "proxmoxer>=1.1,<3",
47
57
  ]
48
58
 
49
59
  [project.urls]
@@ -56,22 +66,16 @@ zbuilder = "zbuilder.cli:cli"
56
66
  # distribution can register providers under the same groups.
57
67
  [project.entry-points."zbuilder.vm"]
58
68
  aws = "zbuilder.vm.aws:vmProvider"
59
- azure = "zbuilder.vm.azure:vmProvider"
60
- do = "zbuilder.vm.do:vmProvider"
61
- ganeti = "zbuilder.vm.ganeti:vmProvider"
62
69
  gcp = "zbuilder.vm.gcp:vmProvider"
70
+ kvm = "zbuilder.vm.kvm:vmProvider"
63
71
  proxmox = "zbuilder.vm.proxmox:vmProvider"
64
- vagrant = "zbuilder.vm.vagrant:vmProvider"
65
72
 
66
73
  [project.entry-points."zbuilder.dns"]
67
74
  ansible = "zbuilder.dns.ansible:dnsProvider"
68
75
  aws = "zbuilder.dns.aws:dnsProvider"
69
- azure = "zbuilder.dns.azure:dnsProvider"
70
76
  bind = "zbuilder.dns.bind:dnsProvider"
71
- do = "zbuilder.dns.do:dnsProvider"
72
77
  gcp = "zbuilder.dns.gcp:dnsProvider"
73
78
  powerdns = "zbuilder.dns.powerdns:dnsProvider"
74
- vagrant = "zbuilder.dns.vagrant:dnsProvider"
75
79
 
76
80
  [project.entry-points."zbuilder.ipam"]
77
81
  phpipam = "zbuilder.ipam.phpipam:ipamProvider"
@@ -88,6 +92,16 @@ docs = [
88
92
  [tool.uv]
89
93
  default-groups = ["dev"]
90
94
 
95
+ # libvirt-python ships as an sdist whose setup.py shells out to `pkg-config
96
+ # libvirt`, so uv cannot even read its metadata without libvirt-dev installed
97
+ # and `uv lock` fails on a machine that has no libvirt at all - CI included.
98
+ # Declaring the metadata here keeps resolution static; the package is still
99
+ # built the normal way at install time, which does need the libvirt headers.
100
+ [[tool.uv.dependency-metadata]]
101
+ name = "libvirt-python"
102
+ version = "11.10.0"
103
+ requires-dist = []
104
+
91
105
  [build-system]
92
106
  requires = ["uv_build>=0.12.5,<0.13.0"]
93
107
  build-backend = "uv_build"
@@ -311,8 +311,8 @@ def plugins(state):
311
311
  for plugin in zbuilder.plugins.names(zbuilder.plugins.VM):
312
312
  try:
313
313
  p = zbuilder.vm.vmProvider(plugin)
314
- p.enabled()
315
- click.echo(f" - {plugin:8}: enabled")
314
+ if p.enabled():
315
+ click.echo(f" - {plugin:8}: enabled")
316
316
  except Exception:
317
317
  pass
318
318
 
@@ -1,10 +1,20 @@
1
+ """GCP DNS provider.
2
+
3
+ Like the gcp vm provider, the google client stack is an optional extra
4
+ (`zbuilder[gcp]`) imported lazily, so this module imports without it.
5
+ """
6
+
1
7
  import time
2
8
  import click
3
9
 
4
10
 
5
11
  from zbuilder.base import DNSProvider
6
- from zbuilder.vm.gcp import auth
7
- from google.cloud import dns
12
+ from zbuilder.vm.gcp import auth, require
13
+
14
+ try:
15
+ from google.cloud import dns
16
+ except ImportError: # installed without the gcp extra
17
+ dns = None
8
18
 
9
19
 
10
20
  DNS_TTL = 60 * 10 # 10 mins
@@ -14,6 +24,7 @@ class dnsProvider(DNSProvider):
14
24
  def __init__(self, cfg):
15
25
  super().__init__(cfg)
16
26
  if cfg:
27
+ require(dns, "google-cloud-dns")
17
28
  creds = auth(self.cfg)
18
29
 
19
30
  try:
@@ -1,18 +1,40 @@
1
+ """GCP provider, driving the google api client.
2
+
3
+ The google client stack is an optional extra (`zbuilder[gcp]`) and is imported
4
+ lazily: this module has to import on a machine without it, or provider
5
+ discovery would break for everybody.
6
+ """
7
+
1
8
  import os
2
9
  import click
3
10
  import pickle
4
- import googleapiclient.discovery
5
11
 
6
12
  from zbuilder.base import VMProvider
7
13
  from zbuilder.dns import dnsUpdate, dnsRemove
8
- from google.oauth2 import service_account
9
- from google_auth_oauthlib.flow import InstalledAppFlow
10
- from google.auth.transport.requests import Request
14
+
15
+ try:
16
+ import googleapiclient.discovery
17
+ from google.oauth2 import service_account
18
+ from google_auth_oauthlib.flow import InstalledAppFlow
19
+ from google.auth.transport.requests import Request
20
+ except ImportError: # installed without the gcp extra
21
+ googleapiclient = None
11
22
 
12
23
  CONFIG_PATH = "~/.config/zbuilder/"
13
24
 
14
25
 
26
+ def require(module, name):
27
+ """The gcp extra is optional, say so instead of raising ImportError"""
28
+ if module is None:
29
+ raise click.ClickException(
30
+ "The gcp provider needs [{}], install it with: pip install 'zbuilder[gcp]'".format(name)
31
+ )
32
+ return module
33
+
34
+
15
35
  def auth(cfg):
36
+ require(googleapiclient, "google-api-python-client")
37
+
16
38
  SCOPES = [
17
39
  "https://www.googleapis.com/auth/compute",
18
40
  "https://www.googleapis.com/auth/ndev.clouddns.readwrite",