Another attempt at getting the VPN form to work
diff --git a/xos/observers/vpn/steps/sync_vpntenant.yaml b/xos/observers/vpn/steps/sync_vpntenant.yaml
index 8dd1d12..02e2feb 100644
--- a/xos/observers/vpn/steps/sync_vpntenant.yaml
+++ b/xos/observers/vpn/steps/sync_vpntenant.yaml
@@ -15,7 +15,7 @@
apt: name=openvpn state=present update_cache=yes
- name: stop openvpn
- shell: killall openvpn
+ shell: killall openvpn | true
- name: erase key
shell: rm -f static.key
diff --git a/xos/services/vpn/admin.py b/xos/services/vpn/admin.py
index 3c63026..47728c4 100644
--- a/xos/services/vpn/admin.py
+++ b/xos/services/vpn/admin.py
@@ -105,7 +105,9 @@
self.instance.server_address = self.cleaned_data.get("server_address")
self.instance.client_address = self.cleaned_data.get("client_address")
self.instance.is_persistent = self.cleaned_data.get('is_persistent')
- self.instance.file_name = self.cleaned_data.get('file_name')
+ self.instance.file_name = self.cleaned_data.get("file_name")
+ if self.instance.file_name == None:
+ raise forms.ValidationError("File name is None despite that not making any sense")
self.instance.can_view_subnet = self.cleaned_data.get(
'can_view_subnet')
return super(VPNTenantForm, self).save(commit=commit)
@@ -128,11 +130,11 @@
list_display_links = ('id', 'backend_status_icon', 'instance')
fieldsets = [(None, {'fields': ['backend_status_text', 'kind',
'provider_service', 'instance', 'creator',
- 'server_key', 'file_name', 'script_link',
+ 'server_key', 'file_name',
'server_address', 'client_address',
'is_persistent', 'can_view_subnet'],
'classes': ['suit-tab suit-tab-general']})]
- readonly_fields = ('backend_status_text', 'instance', 'script_link')
+ readonly_fields = ('backend_status_text', 'instance')
form = VPNTenantForm
suit_form_tabs = (('general', 'Details'),)
diff --git a/xos/services/vpn/models.py b/xos/services/vpn/models.py
index 2cdb5b9..3f996fa 100644
--- a/xos/services/vpn/models.py
+++ b/xos/services/vpn/models.py
@@ -142,7 +142,7 @@
@file_name.setter
def file_name(self, value):
- self.set_attribute('file_name', value)
+ self.set_attribute("file_name", value)
def model_policy_vpn_tenant(pk):