Fix openvpn-needed creation, in case of slapprepare -u.

It used undefined variables because config (ask questions) is not done during update.
parent 56a44154
...@@ -533,6 +533,19 @@ def prepare_from_scratch(config): ...@@ -533,6 +533,19 @@ def prepare_from_scratch(config):
if os.path.exists(temp_directory): if os.path.exists(temp_directory):
print "Deleting directory: %s" % temp_directory print "Deleting directory: %s" % temp_directory
_call(['rm','-rf',temp_directory]) _call(['rm','-rf',temp_directory])
# Add/remove VPN file forcing/forbidding start of VPN.
if not config.dry_run:
openvpn_needed_file_path = os.path.join(slapos_configuration,
'openvpn-needed')
if config.force_vpn:
# Force use of openvpn
open(openvpn_needed_file_path, 'w')
else:
# Forbid use of openvpn if not explicitely defined
os.remove(openvpn_needed_file_path)
return return_code return return_code
...@@ -564,16 +577,6 @@ def slapprepare(): ...@@ -564,16 +577,6 @@ def slapprepare():
configureNtp() configureNtp()
if not config.dry_run:
openvpn_needed_file_path = os.path.join(config.slapos_configuration,
'openvpn-needed')
if config.force_vpn:
# Force use of openvpn
open(openvpn_needed_file_path, 'w')
else:
# Forbid use of openvpn if not explicitely defined
os.remove(openvpn_needed_file_path)
# Enable and run slapos-boot-dedicated.service # Enable and run slapos-boot-dedicated.service
_call(['systemctl','enable','slapos-boot-dedicated.service']) _call(['systemctl','enable','slapos-boot-dedicated.service'])
_call(['systemctl','start','slapos-boot-dedicated.service']) _call(['systemctl','start','slapos-boot-dedicated.service'])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment