Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
a40eeeeb
authored
Oct 24, 2016
by
Szabolcs Gelencser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix azure vm size, template imports
parent
a4cab8dc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
12 deletions
+44
-12
circle/vm/tasks/local_periodic_tasks.py
+44
-12
No files found.
circle/vm/tasks/local_periodic_tasks.py
View file @
a40eeeeb
...
...
@@ -111,7 +111,11 @@ def update_azure_vm_sizes():
REGION
,
)
current_vm_sizes
=
[]
for
vm_size
in
vm_sizes
:
current_vm_sizes
.
append
(
vm_size
.
name
)
try
:
old_vm_size
=
AzureVirtualMachineSize
.
objects
.
get
(
name
=
vm_size
.
name
)
old_vm_size
.
name
=
vm_size
.
name
...
...
@@ -136,6 +140,12 @@ def update_azure_vm_sizes():
logger
.
info
(
"finished importing azure vm sizes"
)
# delete old vm sizes
AzureVirtualMachineSize
.
objects
.
exclude
(
name__in
=
current_vm_sizes
)
.
delete
()
logger
.
info
(
"finished deleting old azure vm sizes"
)
@celery.task
(
ignore_result
=
True
)
def
update_azure_builtin_templates
():
logger
.
info
(
"beginning azure built-in template imports"
)
...
...
@@ -150,9 +160,14 @@ def update_azure_builtin_templates():
REGION
,
)
for
publisher
in
result_list_pub
:
current_publisher
=
AzureBuiltinPublisher
(
azure_id
=
publisher
.
id
,
name
=
publisher
.
name
,
)
try
:
current_publisher
=
AzureBuiltinPublisher
.
objects
.
get
(
azure_id
=
publisher
.
id
)
except
ObjectDoesNotExist
:
current_publisher
=
AzureBuiltinPublisher
(
azure_id
=
publisher
.
id
,
name
=
publisher
.
name
,
)
current_publisher
.
save
()
current_publisher_ids
.
append
(
current_publisher
.
azure_id
)
...
...
@@ -161,9 +176,15 @@ def update_azure_builtin_templates():
publisher
.
name
,
)
for
offer
in
result_list_offers
:
current_offer
=
AzureBuiltinOffer
(
azure_id
=
offer
.
id
,
name
=
offer
.
name
,
publisher
=
current_publisher
)
try
:
current_offer
=
AzureBuiltinOffer
.
objects
.
get
(
azure_id
=
offer
.
id
)
except
ObjectDoesNotExist
:
current_offer
=
AzureBuiltinOffer
(
azure_id
=
offer
.
id
,
name
=
offer
.
name
,
publisher
=
current_publisher
)
current_offer
.
save
()
current_offer_ids
.
append
(
current_offer
.
azure_id
)
...
...
@@ -173,9 +194,14 @@ def update_azure_builtin_templates():
offer
.
name
,
)
for
sku
in
result_list_skus
:
current_sku
=
AzureBuiltinSKU
(
azure_id
=
sku
.
id
,
name
=
sku
.
name
,
offer
=
current_offer
)
try
:
current_sku
=
AzureBuiltinSKU
.
objects
.
get
(
azure_id
=
sku
.
id
)
except
ObjectDoesNotExist
:
current_sku
=
AzureBuiltinSKU
(
azure_id
=
sku
.
id
,
name
=
sku
.
name
,
offer
=
current_offer
)
current_sku
.
save
()
current_sku_ids
.
append
(
current_sku
.
azure_id
)
...
...
@@ -186,9 +212,15 @@ def update_azure_builtin_templates():
sku
.
name
,
)
for
version
in
result_list
:
current_version
=
AzureBuiltinVersion
(
azure_id
=
version
.
id
,
name
=
version
.
name
,
sku
=
current_sku
)
try
:
current_version
=
AzureBuiltinVersion
.
objects
.
get
(
azure_id
=
version
.
id
)
except
ObjectDoesNotExist
:
current_version
=
AzureBuiltinVersion
(
azure_id
=
version
.
id
,
name
=
version
.
name
,
sku
=
current_sku
)
current_version
.
save
()
current_version_ids
.
append
(
current_version
.
azure_id
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment