netbox-vcloud 0.2.4__tar.gz → 0.2.6__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.
- {netbox_vcloud-0.2.4 → netbox_vcloud-0.2.6}/PKG-INFO +1 -1
- {netbox_vcloud-0.2.4 → netbox_vcloud-0.2.6}/netbox_vcloud/jobs/cloudsync.py +18 -6
- netbox_vcloud-0.2.6/netbox_vcloud/template_content.py +26 -0
- {netbox_vcloud-0.2.4 → netbox_vcloud-0.2.6}/netbox_vcloud.egg-info/PKG-INFO +1 -1
- {netbox_vcloud-0.2.4 → netbox_vcloud-0.2.6}/pyproject.toml +1 -1
- netbox_vcloud-0.2.4/netbox_vcloud/template_content.py +0 -22
- {netbox_vcloud-0.2.4 → netbox_vcloud-0.2.6}/MANIFEST.in +0 -0
- {netbox_vcloud-0.2.4 → netbox_vcloud-0.2.6}/README.md +0 -0
- {netbox_vcloud-0.2.4 → netbox_vcloud-0.2.6}/netbox_vcloud/__init__.py +0 -0
- {netbox_vcloud-0.2.4 → netbox_vcloud-0.2.6}/netbox_vcloud/admin.py +0 -0
- {netbox_vcloud-0.2.4 → netbox_vcloud-0.2.6}/netbox_vcloud/api/serializers.py +0 -0
- {netbox_vcloud-0.2.4 → netbox_vcloud-0.2.6}/netbox_vcloud/api/urls.py +0 -0
- {netbox_vcloud-0.2.4 → netbox_vcloud-0.2.6}/netbox_vcloud/api/views.py +0 -0
- {netbox_vcloud-0.2.4 → netbox_vcloud-0.2.6}/netbox_vcloud/forms.py +0 -0
- {netbox_vcloud-0.2.4 → netbox_vcloud-0.2.6}/netbox_vcloud/jobs/__init__.py +0 -0
- {netbox_vcloud-0.2.4 → netbox_vcloud-0.2.6}/netbox_vcloud/migrations/0001_initial.py +0 -0
- {netbox_vcloud-0.2.4 → netbox_vcloud-0.2.6}/netbox_vcloud/migrations/0002_cloudsyncconfig_next_sync.py +0 -0
- {netbox_vcloud-0.2.4 → netbox_vcloud-0.2.6}/netbox_vcloud/migrations/0003_cloudsyncconfig_netbox_cluster_and_more.py +0 -0
- {netbox_vcloud-0.2.4 → netbox_vcloud-0.2.6}/netbox_vcloud/migrations/__init__.py +0 -0
- {netbox_vcloud-0.2.4 → netbox_vcloud-0.2.6}/netbox_vcloud/models.py +0 -0
- {netbox_vcloud-0.2.4 → netbox_vcloud-0.2.6}/netbox_vcloud/navigation.py +0 -0
- {netbox_vcloud-0.2.4 → netbox_vcloud-0.2.6}/netbox_vcloud/sync.py +0 -0
- {netbox_vcloud-0.2.4 → netbox_vcloud-0.2.6}/netbox_vcloud/sync_utils.py +0 -0
- {netbox_vcloud-0.2.4 → netbox_vcloud-0.2.6}/netbox_vcloud/tables.py +0 -0
- {netbox_vcloud-0.2.4 → netbox_vcloud-0.2.6}/netbox_vcloud/templates/netbox_vcloud/cloudsyncconfig.html +0 -0
- {netbox_vcloud-0.2.4 → netbox_vcloud-0.2.6}/netbox_vcloud/templates/netbox_vcloud/cloudsyncconfig_list.html +0 -0
- {netbox_vcloud-0.2.4 → netbox_vcloud-0.2.6}/netbox_vcloud/templatetags/__init__.py +0 -0
- {netbox_vcloud-0.2.4 → netbox_vcloud-0.2.6}/netbox_vcloud/templatetags/boolean_icon.py +0 -0
- {netbox_vcloud-0.2.4 → netbox_vcloud-0.2.6}/netbox_vcloud/urls.py +0 -0
- {netbox_vcloud-0.2.4 → netbox_vcloud-0.2.6}/netbox_vcloud/views.py +0 -0
- {netbox_vcloud-0.2.4 → netbox_vcloud-0.2.6}/netbox_vcloud.egg-info/SOURCES.txt +0 -0
- {netbox_vcloud-0.2.4 → netbox_vcloud-0.2.6}/netbox_vcloud.egg-info/dependency_links.txt +0 -0
- {netbox_vcloud-0.2.4 → netbox_vcloud-0.2.6}/netbox_vcloud.egg-info/requires.txt +0 -0
- {netbox_vcloud-0.2.4 → netbox_vcloud-0.2.6}/netbox_vcloud.egg-info/top_level.txt +0 -0
- {netbox_vcloud-0.2.4 → netbox_vcloud-0.2.6}/setup.cfg +0 -0
- {netbox_vcloud-0.2.4 → netbox_vcloud-0.2.6}/test/test_sync_utils.py +0 -0
|
@@ -42,7 +42,10 @@ class CloudSyncJob(JobRunner):
|
|
|
42
42
|
try:
|
|
43
43
|
self.logger.info(f"➡️ Sync '{cfg.name}' ({cfg.vcloud_url}) ...")
|
|
44
44
|
|
|
45
|
-
self.sync_config(cfg)
|
|
45
|
+
ok = self.sync_config(cfg)
|
|
46
|
+
if not ok:
|
|
47
|
+
self.logger.error(f"❌ '{cfg.name}' failed")
|
|
48
|
+
continue
|
|
46
49
|
|
|
47
50
|
# 🕓 Update time sync
|
|
48
51
|
cfg.last_sync = timezone.now()
|
|
@@ -68,7 +71,7 @@ class CloudSyncJob(JobRunner):
|
|
|
68
71
|
creds_b64 = base64.b64encode(creds.encode()).decode()
|
|
69
72
|
|
|
70
73
|
token_resp = requests.post(
|
|
71
|
-
f"{cfg.vcloud_url}/cloudapi/1.0.0/sessions"
|
|
74
|
+
f"{cfg.vcloud_url.rstrip('/')}/cloudapi/1.0.0/sessions"
|
|
72
75
|
headers={
|
|
73
76
|
"Authorization": f"Basic {creds_b64}",
|
|
74
77
|
"Accept": "application/*;version=38.1",
|
|
@@ -76,13 +79,20 @@ class CloudSyncJob(JobRunner):
|
|
|
76
79
|
timeout=15,
|
|
77
80
|
)
|
|
78
81
|
if token_resp.status_code != 200:
|
|
79
|
-
self.logger.
|
|
80
|
-
|
|
82
|
+
self.logger.error(
|
|
83
|
+
f"Auth failed for {cfg.name}: HTTP {token_resp.status_code}; "
|
|
84
|
+
f"response={token_resp.text[:500]}"
|
|
85
|
+
)
|
|
86
|
+
return False
|
|
87
|
+
|
|
81
88
|
|
|
82
89
|
vcloud_token = token_resp.headers.get("x-vmware-vcloud-access-token")
|
|
83
90
|
if not vcloud_token:
|
|
84
|
-
self.logger.
|
|
85
|
-
|
|
91
|
+
self.logger.error(
|
|
92
|
+
f"Empty token in response from {cfg.name}; headers={dict(token_resp.headers)}"
|
|
93
|
+
)
|
|
94
|
+
return False
|
|
95
|
+
|
|
86
96
|
|
|
87
97
|
self.logger.info(f"✅ Token received for {cfg.name}")
|
|
88
98
|
|
|
@@ -130,6 +140,8 @@ class CloudSyncJob(JobRunner):
|
|
|
130
140
|
self.logger.error(f"⚠️ Error during sync_vm {vm.get('name')}: {e}")
|
|
131
141
|
continue
|
|
132
142
|
|
|
143
|
+
return True
|
|
144
|
+
|
|
133
145
|
# ======================================================
|
|
134
146
|
# 🧠 Processing a single VM + interfaces + IP
|
|
135
147
|
# ======================================================
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from netbox.plugins import PluginTemplateExtension
|
|
2
|
+
from django.urls import reverse
|
|
3
|
+
from django.utils.html import format_html
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class CloudSyncConfigButtons(PluginTemplateExtension):
|
|
7
|
+
model = "netbox_vcloud.cloudsyncconfig"
|
|
8
|
+
|
|
9
|
+
def buttons(self):
|
|
10
|
+
obj = self.context.get("object")
|
|
11
|
+
if (
|
|
12
|
+
not obj
|
|
13
|
+
or obj._meta.label_lower != "netbox_vcloud.cloudsyncconfig"
|
|
14
|
+
or not getattr(obj, "pk", None)
|
|
15
|
+
):
|
|
16
|
+
return ""
|
|
17
|
+
|
|
18
|
+
url = reverse("plugins:netbox_vcloud:run_sync_now", kwargs={"pk": obj.pk})
|
|
19
|
+
return format_html(
|
|
20
|
+
'<a href="{}" class="btn btn-sm btn-primary">'
|
|
21
|
+
'<i class="mdi mdi-sync"></i> Run Sync Now</a>',
|
|
22
|
+
url,
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
template_extensions = [CloudSyncConfigButtons]
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
from netbox.plugins import PluginTemplateExtension
|
|
2
|
-
from django.urls import reverse
|
|
3
|
-
from django.utils.html import format_html
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class CloudSyncConfigButtons(PluginTemplateExtension):
|
|
7
|
-
model = 'netbox_vcloud.cloudsyncconfig'
|
|
8
|
-
|
|
9
|
-
def buttons(self):
|
|
10
|
-
obj = self.context.get('object')
|
|
11
|
-
if not obj or obj._meta.label_lower != 'netbox_vcloud.cloudsyncconfig':
|
|
12
|
-
return ""
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
url = reverse('plugins:netbox_vcloud:run_sync_now', args=[obj.pk])
|
|
16
|
-
return format_html(
|
|
17
|
-
f'<a href="{url}" class="btn btn-sm btn-primary">'
|
|
18
|
-
f'<i class="mdi mdi-sync"></i> Run Sync Now</a>'
|
|
19
|
-
)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
template_extensions = [CloudSyncConfigButtons]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|