Allow ommsync mode to be used in cli

This commit is contained in:
clerie 2022-06-16 22:40:01 +02:00
parent 4796d1587b
commit 501be198c4
2 changed files with 5 additions and 2 deletions

View File

@ -48,7 +48,8 @@ class OMMClient2:
m = messages.Open() m = messages.Open()
m.username = self._username m.username = self._username
m.password = self._password m.password = self._password
m.UserDeviceSyncClient = self._ommsync if self._ommsync:
m.UserDeviceSyncClient = "true"
r = self.connection.request(m) r = self.connection.request(m)
r.raise_on_error() r.raise_on_error()

4
ommcli
View File

@ -35,18 +35,20 @@ if __name__ == "__main__":
connect_parser.add_argument("-n", dest="hostname", default="127.0.0.1") connect_parser.add_argument("-n", dest="hostname", default="127.0.0.1")
connect_parser.add_argument("-u", dest="username", default="omm") connect_parser.add_argument("-u", dest="username", default="omm")
connect_parser.add_argument("-p", dest="password") connect_parser.add_argument("-p", dest="password")
connect_parser.add_argument("--ommsync", dest="ommsync", action='store_true', help="Log in with ommsync mode")
connect_parser.add_argument("subcommand", nargs="*") connect_parser.add_argument("subcommand", nargs="*")
args = connect_parser.parse_args() args = connect_parser.parse_args()
hostname = args.hostname hostname = args.hostname
username = args.username username = args.username
password = args.password password = args.password
ommsync = args.ommsync
subcommand = args.subcommand subcommand = args.subcommand
if not password: if not password:
password = getpass.getpass(prompt="OMM password for {}@{}:".format(username, hostname)) password = getpass.getpass(prompt="OMM password for {}@{}:".format(username, hostname))
c = OMMClient2(hostname, username, password) c = OMMClient2(hostname, username, password, ommsync=ommsync)
def encrypt(secret): def encrypt(secret):
if rsa is None: if rsa is None: