Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Guillaume Hervier
slapos.core
Commits
bea9bfd6
Commit
bea9bfd6
authored
Nov 09, 2012
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Try to use default_network_interface id when possible.
parent
058d9165
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
8 deletions
+10
-8
master/bt5/slapos_slap_tool/SkinTemplateItem/portal_skins/slapos_slap_tool/Computer_updateFromDict.xml
...portal_skins/slapos_slap_tool/Computer_updateFromDict.xml
+9
-7
master/bt5/slapos_slap_tool/bt/revision
master/bt5/slapos_slap_tool/bt/revision
+1
-1
No files found.
master/bt5/slapos_slap_tool/SkinTemplateItem/portal_skins/slapos_slap_tool/Computer_updateFromDict.xml
View file @
bea9bfd6
...
@@ -55,23 +55,25 @@
...
@@ -55,23 +55,25 @@
additional_dict = {}\n
additional_dict = {}\n
to_delete_ip_id_list = []\n
to_delete_ip_id_list = []\n
to_add_ip_dict_list = address_list[:]\n
to_add_ip_dict_list = address_list[:]\n
for address in document.contentValues(portal_type=\'Internet Protocol Address\'):\n
existing_address_list = document.contentValues(portal_type=\'Internet Protocol Address\')\n
existing_address_list.sort(key=lambda x: {0: 1, 1: 2}[int(x.id == \'default_network_interface\')])\n
for address in existing_address_list:\n
current_dict = {\n
current_dict = {\n
\'addr\': address.getIpAddress(),\n
\'addr\': address.getIpAddress(),\n
\'netmask\': address.getNetmask()\n
\'netmask\': address.getNetmask()\n
}\n
}\n
if not current_dict in to_add_ip_dict_list:\n
if current_dict in to_add_ip_dict_list:\n
to_delete_ip_id_list.append(address.getId())\n
else:\n
to_add_ip_dict_list.remove(current_dict)\n
to_add_ip_dict_list.remove(current_dict)\n
\n
else:\n
to_delete_ip_id_list.append(address.getId())\n
\n
for address in to_add_ip_dict_list:\n
for address in to_add_ip_dict_list:\n
if to_delete_ip_id_list:\n
if to_delete_ip_id_list:\n
id = to_delete_ip_id_list.pop()\n
id = to_delete_ip_id_list.pop()\n
address_document =
getattr(document,
id)\n
address_document =
document.restrictedTraverse(
id)\n
else:\n
else:\n
kw = {\'portal_type\': \'Internet Protocol Address\'}\n
kw = {\'portal_type\': \'Internet Protocol Address\'}\n
if len(document.objectIds(portal_type=\'Internet Protocol Address\')):\n
if
not
len(document.objectIds(portal_type=\'Internet Protocol Address\')):\n
kw.update(id=\'default_network_address\')\n
kw.update(id=\'default_network_address\')\n
address_document = document.newContent(**kw)\n
address_document = document.newContent(**kw)\n
address_document.edit(\n
address_document.edit(\n
...
...
master/bt5/slapos_slap_tool/bt/revision
View file @
bea9bfd6
12
13
\ No newline at end of file
\ No newline at end of file
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