mirror of https://git.48k.eu/ogcli/
send: add send refresh
Send refresh to a given client. $ ogcli send refresh --client-ip 192.168.56.11master
parent
e7b302c8b8
commit
397663fd37
|
@ -82,7 +82,7 @@ class OgCLI():
|
|||
OgModes.set_modes(self.rest, args[1:])
|
||||
|
||||
def send(self, args):
|
||||
choices = ['wol', 'poweroff']
|
||||
choices = ['wol', 'poweroff', 'refresh']
|
||||
parser = argparse.ArgumentParser(prog='ogcli send')
|
||||
parser.add_argument('send_obj', choices=choices)
|
||||
parsed_args = parser.parse_args([args[0]])
|
||||
|
@ -91,6 +91,8 @@ class OgCLI():
|
|||
OgWol.send_wol(self.rest, args[1:])
|
||||
elif parsed_args.send_obj == 'poweroff':
|
||||
OgPoweroff.send_poweroff(self.rest, args[1:])
|
||||
elif parsed_args.send_obj == 'refresh':
|
||||
OgClient.send_refresh(self.rest, args[1:])
|
||||
|
||||
def restore(self, args):
|
||||
choices = ['image']
|
||||
|
|
|
@ -42,3 +42,16 @@ class OgClient():
|
|||
payload = {'client': parsed_args.client_ip}
|
||||
r = rest.get('/client/info', payload=payload)
|
||||
print_json(r.text)
|
||||
|
||||
@staticmethod
|
||||
def send_refresh(rest, args):
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--client-ip',
|
||||
action='append',
|
||||
default=[],
|
||||
required=True,
|
||||
help='Client IP')
|
||||
parsed_args = parser.parse_args(args)
|
||||
|
||||
payload = {'clients': parsed_args.client_ip}
|
||||
rest.post('/refresh', payload=payload)
|
||||
|
|
Loading…
Reference in New Issue