Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
loglux committed Dec 28, 2020
1 parent 27d80b9 commit 8efa06b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions vpol.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ def all_rules(self, d_conf, s_conf):
self.vpn_list = ''.join(self.vpn_list)

@staticmethod
def unset_nvram(num=''):
def unset_nvram(client=''):
for n in ['', 1, 2, 3, 4, 5]:
box = f"nvram unset vpn_client{str(num)}_clientlist{str(n)}"
box = f"nvram unset vpn_client{str(client)}_clientlist{str(n)}"
print(box)
os.system(box)

def set_nvram(self, seq=1):
def set_nvram(self, client=1):
n = 255
chunks = [self.vpn_list[i:i + n] for i in range(0, len(self.vpn_list), n)]
all_lists = []
Expand All @@ -86,7 +86,7 @@ def set_nvram(self, seq=1):
except IndexError:
pass
for x in all_lists:
vpn_list = f'nvram set vpn_client{str(seq)}_{str(x["list"])}="{str(x["content"])}"'
vpn_list = f'nvram set vpn_client{str(client)}_{str(x["list"])}="{str(x["content"])}"'
print(vpn_list)
os.system(vpn_list)

Expand All @@ -96,8 +96,8 @@ def nvram_commit():
os.system("nvram commit")

@staticmethod
def client_restart(clnum=1):
service_restart = "service restart_client" + str(clnum)
def client_restart(client=1):
service_restart = "service restart_client" + str(client)
# print(service_restart)
os.system(service_restart)

Expand Down

0 comments on commit 8efa06b

Please sign in to comment.