mirror of
https://github.com/altlinux/gpupdate.git
synced 2025-03-21 18:50:38 +03:00
control module become obsolete
This commit is contained in:
parent
85e3de7286
commit
0ad9e7c90d
@ -1,38 +0,0 @@
|
||||
import subprocess
|
||||
import threading
|
||||
|
||||
class control:
|
||||
def __init__(self, name, value):
|
||||
self.control_name = name
|
||||
self.control_value = value
|
||||
self.possible_values = self._query_control_values()
|
||||
if self.possible_values == None:
|
||||
raise Exception('Unable to query possible values')
|
||||
|
||||
def _query_control_values(self):
|
||||
proc = subprocess.Popen(['sudo', 'control', self.control_name, 'list'], stdout=subprocess.PIPE)
|
||||
for line in proc.stdout:
|
||||
values = line.split()
|
||||
return values
|
||||
|
||||
def _map_control_status(self, int_status):
|
||||
str_status = self.possible_values[int_status].decode()
|
||||
return str_status
|
||||
|
||||
def get_control_name(self):
|
||||
return self.control_name
|
||||
|
||||
def get_control_status(self):
|
||||
proc = subprocess.Popen(['sudo', 'control', self.control_name], stdout=subprocess.PIPE)
|
||||
for line in proc.stdout:
|
||||
return line.rstrip('\n\r')
|
||||
|
||||
def set_control_status(self):
|
||||
status = self._map_control_status(self.control_value)
|
||||
print('Setting control {} to {}'.format(self.control_name, status))
|
||||
|
||||
try:
|
||||
proc = subprocess.Popen(['sudo', 'control', self.control_name, status], stdout=subprocess.PIPE)
|
||||
except:
|
||||
print('Unable to set {} to {}'.format(self.control_name, status))
|
||||
|
Loading…
x
Reference in New Issue
Block a user