Merge lp:~alitvinov/landscape-client-charm/Improve-reporting-lp1800687 into lp:landscape-client-charm

Proposed by Alexander Litvinov on 2019-05-27
Status: Needs review
Proposed branch: lp:~alitvinov/landscape-client-charm/Improve-reporting-lp1800687
Merge into: lp:landscape-client-charm
Diff against target: 37 lines (+17/-1)
1 file modified
hooks/common.py (+17/-1)
To merge this branch: bzr merge lp:~alitvinov/landscape-client-charm/Improve-reporting-lp1800687
Reviewer Review Type Date Requested Status
Landscape Builder test results Needs Fixing on 2020-09-27
Landscape 2019-05-27 Pending
Review via email: mp+367966@code.launchpad.net

Commit message

Fixes to improve error handling during registration process with landscape-server.
For lp:1772064 lp:1800687

Description of the change

Fix landscape-client charm reporting "Successfully registered" when it actually fails during registration.

To post a comment you must log in.
review: Abstain (executing tests)
review: Needs Fixing (test results)
review: Abstain (executing tests)
review: Needs Fixing (test results)
Alexander Litvinov (alitvinov) wrote :

Failing are unit tests, need some adjustment.
Will fix.

review: Abstain (executing tests)
review: Needs Fixing (test results)
71. By Alexander Litvinov <email address hidden> on 2019-05-28

Leave old statuses

review: Abstain (executing tests)
review: Needs Fixing (test results)
72. By Alexander Litvinov <email address hidden> on 2019-05-28

Fix too long lines

review: Abstain (executing tests)
review: Approve (test results)
review: Abstain (executing tests)
review: Approve (test results)
review: Abstain (executing tests)
review: Approve (test results)
review: Abstain (executing tests)
review: Approve (test results)
review: Abstain (executing tests)
review: Approve (test results)
review: Abstain (executing tests)
review: Needs Fixing (test results)
review: Abstain (executing tests)
review: Approve (test results)
review: Abstain (executing tests)
review: Approve (test results)
review: Abstain (executing tests)
review: Approve (test results)
review: Abstain (executing tests)
review: Needs Fixing (test results)
review: Abstain (executing tests)
review: Needs Fixing (test results)
review: Abstain (executing tests)
review: Needs Fixing (test results)
review: Abstain (executing tests)
review: Needs Fixing (test results)
review: Abstain (executing tests)
review: Needs Fixing (test results)
review: Abstain (executing tests)
review: Needs Fixing (test results)
review: Abstain (executing tests)
review: Needs Fixing (test results)
review: Abstain (executing tests)
review: Needs Fixing (test results)
review: Abstain (executing tests)
review: Needs Fixing (test results)
review: Abstain (executing tests)
review: Needs Fixing (test results)
review: Abstain (executing tests)
review: Needs Fixing (test results)
review: Abstain (executing tests)
review: Needs Fixing (test results)
review: Abstain (executing tests)
review: Needs Fixing (test results)
review: Abstain (executing tests)
review: Needs Fixing (test results)
review: Abstain (executing tests)
review: Needs Fixing (test results)
review: Abstain (executing tests)
review: Needs Fixing (test results)
review: Abstain (executing tests)
review: Needs Fixing (test results)
review: Abstain (executing tests)
review: Needs Fixing (test results)
review: Abstain (executing tests)
review: Needs Fixing (test results)
review: Abstain (executing tests)
review: Needs Fixing (test results)
review: Abstain (executing tests)
review: Needs Fixing (test results)
review: Abstain (executing tests)
review: Needs Fixing (test results)
review: Abstain (executing tests)
review: Needs Fixing (test results)
review: Abstain (executing tests)
review: Needs Fixing (test results)
review: Abstain (executing tests)
review: Needs Fixing (test results)
review: Abstain (executing tests)
review: Needs Fixing (test results)
review: Abstain (executing tests)
review: Needs Fixing (test results)
review: Abstain (executing tests)
review: Needs Fixing (test results)
review: Abstain (executing tests)
review: Needs Fixing (test results)
review: Abstain (executing tests)
review: Needs Fixing (test results)
review: Abstain (executing tests)
review: Needs Fixing (test results)

Unmerged revisions

72. By Alexander Litvinov <email address hidden> on 2019-05-28

Fix too long lines

71. By Alexander Litvinov <email address hidden> on 2019-05-28

Leave old statuses

70. By Alexander Litvinov <email address hidden> on 2019-05-27

Fix string format

69. By Alexander Litvinov <email address hidden> on 2019-05-27

Improve reporting lp#1800687 lp#1772064

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/common.py'
2--- hooks/common.py 2019-02-03 14:50:36 +0000
3+++ hooks/common.py 2019-05-28 09:45:15 +0000
4@@ -119,6 +119,11 @@
5 exit_code = self.try_to_register()
6 if exit_code == 0:
7 self.status_set("active", "System successfully registered")
8+ log("Client config updated, system successfully registered")
9+ else:
10+ self.status_set("maintenance", "Client registration fails")
11+ log("Client config updated, tried registration but failed")
12+ log("Exit code: %s" % exit_code)
13 else:
14 if not self.config.get("account_name"):
15 self.status_set(
16@@ -179,11 +184,22 @@
17 try:
18 setup(config)
19 except ConfigurationError as error:
20+ log("%s: Configuration error" % self.local_unit)
21 print >> sys.stderr, "Configuration error: %s" % (str(error),)
22 error_handler.flag_error(1)
23 else:
24 log("Registering %s" % self.local_unit)
25- register(config, on_error=error_handler.flag_error)
26+ result = 0
27+ try:
28+ result = register(config, on_error=error_handler.flag_error)
29+ log("Registration result is %s" % str(result))
30+ except SystemExit:
31+ log("Registration unsuccessful, SystemExit() happened")
32+ log("Check broker log or try manual registration")
33+ log(result)
34+ error_handler.flag_error(1)
35+
36+ log("Registration exit_code = %s" % error_handler.exit_code)
37 return error_handler.exit_code
38
39

Subscribers

People subscribed via source and target branches

to all changes: