Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package orthos-client for openSUSE:Factory checked in at 2021-10-15 23:04:11 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/orthos-client (Old) and /work/SRC/openSUSE:Factory/.orthos-client.new.1890 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "orthos-client" Fri Oct 15 23:04:11 2021 rev:2 rq:925388 version:1.0.135+git.c802577 Changes: -------- --- /work/SRC/openSUSE:Factory/orthos-client/orthos-client.changes 2021-10-08 00:05:53.093736469 +0200 +++ /work/SRC/openSUSE:Factory/.orthos-client.new.1890/orthos-client.changes 2021-10-15 23:04:46.082131875 +0200 @@ -1,0 +2,23 @@ +Fri Oct 15 08:48:07 UTC 2021 - [email protected] + +- Update to version 1.0.135+git.c802577: + * Add missing import in client + +------------------------------------------------------------------- +Fri Oct 15 07:21:55 UTC 2021 - [email protected] + +- Update to version 1.0.133+git.66567a6: + * Tiny fixups + * Show logged in user in command prompt + * Do not enforce username, token is enough + * Introduce new client parameter: -c/--config to pass an addtional orthosrc config file + * Move user orthosrc file to ~/.config/orthosrc + +------------------------------------------------------------------- +Tue Oct 12 20:36:55 UTC 2021 - [email protected] + +- Update to version 1.0.116+git.68f5ece: + * Move user orthosrc file to ~/.config/orthosrc + * Add manpage generated in orthos2 server package via Source1: tag + +------------------------------------------------------------------- Old: ---- orthos2-1.0.102+git.a6bbc34.obscpio New: ---- orthos2-1.0.135+git.c802577.obscpio orthos2.1 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ orthos-client.spec ++++++ --- /var/tmp/diff_new_pack.adxr3H/_old 2021-10-15 23:04:46.718132327 +0200 +++ /var/tmp/diff_new_pack.adxr3H/_new 2021-10-15 23:04:46.722132330 +0200 @@ -17,13 +17,14 @@ Name: orthos-client -Version: 1.0.102+git.a6bbc34 +Version: 1.0.135+git.c802577 Release: 0 Summary: Command line client for orthos2 License: GPL-2.0-or-later Group: Productivity/Networking/Boot/Servers URL: https://github.com/openSUSE/orthos2 Source: orthos2-%{version}.tar.gz +Source1: orthos2.1 Requires: python3-base Requires: python3-pytz BuildArch: noarch @@ -40,11 +41,13 @@ %install mkdir -p %{buildroot}/%{_bindir} +mkdir -p %{buildroot}/%{_mandir}/man1 install orthos2 %{buildroot}/%{_bindir}/orthos2 - +install -m 644 %{S:1} %{buildroot}/%{_mandir}/man1/orthos.1 %files %attr(755, root, root) %{_bindir}/orthos2 +%{_mandir}/man1/orthos.1%{?ext_man} %changelog ++++++ orthos2-1.0.102+git.a6bbc34.obscpio -> orthos2-1.0.135+git.c802577.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/orthos2-1.0.102+git.a6bbc34/orthos2 new/orthos2-1.0.135+git.c802577/orthos2 --- old/orthos2-1.0.102+git.a6bbc34/orthos2 2021-10-07 17:36:22.000000000 +0200 +++ new/orthos2-1.0.135+git.c802577/orthos2 2021-10-15 10:47:51.000000000 +0200 @@ -37,10 +37,10 @@ DEFAULT_PORT = '443' API_URL_FORMAT = '{0}://{1}:{2}/api' -USER_CONFIGFILE = '~/.orthosrc' +USER_CONFIGFILE = '~/.config/orthosrc' SYSTEM_CONFIGFILE = '/etc/orthosrc' USER_HISTORYFILE = '~/.orthos_history' -PROMPT = '(orthos {0})'.format(VERSION) +PROMPT = '(orthos {0}:{1})' PROMPT_LOADING = 'Please wait...' LEFT_MARGIN = 30 @@ -150,6 +150,8 @@ return value +def get_prompt(user): + return PROMPT.format(VERSION, user) class Command: @@ -353,7 +355,7 @@ elif input_value.lower() in {'0', 'n', 'no', 'false'}: value = False else: - raise ValueError("Value is not a boolean; use 'y' or 'n'!".format(str(input_value))) + raise ValueError("Value {0} is not a boolean; use 'y' or 'n'!".format(str(input_value))) return value @@ -792,6 +794,7 @@ self.__port = None self.__server = None self.__user = None + self.__auth_user = None self.__password = None self.__use_pager = None self.__timezone = None @@ -875,6 +878,14 @@ else: return pwd.getpwuid(os.getuid())[0] + def set_auth_user(self, user): + self.__auth_user = user + + def get_auth_user(self): + if not self.__auth_user: + return "Anonymous" + return self.__auth_user + def set_use_pager(self, use_pager): values = [ 'always', @@ -958,6 +969,9 @@ with open(os.path.expanduser(USER_CONFIGFILE), 'w') as f: self.__cp.write(f) + def read_config(self, f: str): + self.__cp.read(f) + class Orthos: @@ -1072,6 +1086,7 @@ ) header, data = self.API.request('GET', API_URL) + orthos.config.set_auth_user(data.get('user')) self._commands = [ Command(command, values) for command, values in data['commands'].items() @@ -1115,8 +1130,11 @@ [str(command) for command in self._commands], help='Provides help.' ) - + self.username = self.config.get_user() + if not self.username: + print("Empty username - Use -u/--user or check %s or %s" % (USER_CONFIGFILE, SYSTEM_CONFIGFILE)) + exit(1) self.recent_command = None commands = {} @@ -1191,7 +1209,6 @@ if password is not None: self.API.request_token(self.username, password) - if not self.API.get_token(): print("ERROR: Authorization error!") @@ -1199,7 +1216,6 @@ self.recent_command = None return None - else: password = self.get_password() @@ -1215,6 +1231,10 @@ if not self.API.get_token(): print("ERROR: Authorization error!") + return + + self.config.set_auth_user(self.username) + self.LineReader.set_prompt(get_prompt(self.config.get_auth_user())) def is_authenticated(self): """Check if the user is already authenticated (token set).""" @@ -1247,7 +1267,7 @@ ) if sys.stdin.isatty(): - self.LineReader.set_prompt(PROMPT) + self.LineReader.set_prompt(get_prompt(self.config.get_auth_user())) while True: try: @@ -1348,6 +1368,13 @@ ) parser.add_argument( + '-c', + '--config', + dest='config_file', + help='Additionally read this file as config file after reading %s and %s' % (SYSTEM_CONFIGFILE, USER_CONFIGFILE) + ) + + parser.add_argument( '-P', '--port', dest='port', @@ -1453,6 +1480,9 @@ options = parser.parse_args() + if options.config_file: + orthos.config.read_config(options.config_file) + if options.debug: if options.logfile: logging.basicConfig( ++++++ orthos2-1.0.102+git.a6bbc34.obscpio -> orthos2.1 ++++++ Binary files /work/SRC/openSUSE:Factory/orthos-client/orthos2-1.0.102+git.a6bbc34.obscpio and /work/SRC/openSUSE:Factory/.orthos-client.new.1890/orthos2.1 differ ++++++ orthos2.obsinfo ++++++ --- /var/tmp/diff_new_pack.adxr3H/_old 2021-10-15 23:04:46.866132433 +0200 +++ /var/tmp/diff_new_pack.adxr3H/_new 2021-10-15 23:04:46.866132433 +0200 @@ -1,5 +1,5 @@ name: orthos2 -version: 1.0.102+git.a6bbc34 -mtime: 1633620982 -commit: a6bbc347a05fbb6c324f813dfc5dc078a77a30ec +version: 1.0.135+git.c802577 +mtime: 1634287671 +commit: c80257790d4e56a8eca6d98ada51699e82768d8c
