Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

Add configuration paramater for wait-for-secondary #1562

Merged
merged 5 commits into from
Feb 21, 2020

Conversation

lbonn
Copy link
Contributor

@lbonn lbonn commented Feb 17, 2020

As we want to track this value on the backend, it needs to show up in
our main configuration object which gets sent when aktualizr starts.

pattivacek
pattivacek previously approved these changes Feb 17, 2020
Copy link
Collaborator

@pattivacek pattivacek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this affect any tests, or should this get tested somehow? Just checking, it's probably fine as is.

@lbonn
Copy link
Contributor Author

lbonn commented Feb 17, 2020

@patrickvacek yes I think we can write a test with a short timeout and unavailable ip secondary and check that it returns the error we expect.

@codecov-io
Copy link

codecov-io commented Feb 18, 2020

Codecov Report

Merging #1562 into master will increase coverage by 0.13%.
The diff coverage is 95.94%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1562      +/-   ##
==========================================
+ Coverage   82.05%   82.18%   +0.13%     
==========================================
  Files         189      189              
  Lines       11840    11857      +17     
==========================================
+ Hits         9715     9745      +30     
+ Misses       2125     2112      -13
Impacted Files Coverage Δ
src/libaktualizr/config/config.h 100% <ø> (ø) ⬆️
src/libaktualizr/primary/sotauptaneclient.h 100% <ø> (ø) ⬆️
src/libaktualizr/config/config.cc 94.26% <100%> (+0.07%) ⬆️
src/libaktualizr/primary/sotauptaneclient.cc 90.66% <95.83%> (+0.66%) ⬆️
src/libaktualizr/storage/sqlstorage.cc 77.77% <0%> (+0.57%) ⬆️
src/libaktualizr/storage/sqlstorage_base.cc 78.37% <0%> (+2.02%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0327762...5187769. Read the comment docs.

pattivacek
pattivacek previously approved these changes Feb 18, 2020
Copy link
Collaborator

@pattivacek pattivacek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still looks good, and I'm still in favor of a test (whether in this PR or another doesn't matter to me).

@lbonn
Copy link
Contributor Author

lbonn commented Feb 18, 2020

@patrickvacek yes, I think this time we should wait for the test to merge actually. Sorry, should have marked it as not ready.

It still contained `secondary_configs_dir` which has been removed.

Signed-off-by: Laurent Bonnans <laurent.bonnans@here.com>
As we want to track this value on the backend, it needs to show up in
our main configuration object which gets sent when aktualizr starts.

Signed-off-by: Laurent Bonnans <laurent.bonnans@here.com>
Signed-off-by: Laurent Bonnans <laurent.bonnans@here.com>
@lbonn lbonn force-pushed the feat/OTA-4422/secondary-wait-timeout branch 3 times, most recently from 245f67e to 8cea082 Compare February 20, 2020 15:01
@lbonn lbonn force-pushed the feat/OTA-4422/secondary-wait-timeout branch from 8cea082 to 5187769 Compare February 20, 2020 15:53
A series of operations are needed after all the install steps are
attempted and it's easy to miss one.

The common post-processing is now placed at the end of a lambda call, so
that nothing can be omitted.

Signed-off-by: Laurent Bonnans <laurent.bonnans@here.com>
Signed-off-by: Laurent Bonnans <laurent.bonnans@here.com>
bool drop_targets = false;

std::tie(r, raw_report, drop_targets) = [this, &updates,
&correlation_id]() -> std::tuple<result::Install, std::string, bool> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great idea and should really make things easier to deal with. Took me a minute to follow it, though. I think part of it is that the lambda is rather large. Would it perhaps make it easier to just make it a proper function? Or would that be unnecessary? I realize most of this function is the lambda now, so maybe that wouldn't really help things...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tend to agree actually but my bad excuse is that I don't really know how to name this function, it's really doing the bulk of the work...

The do { ... break; } while(0); idiom was considered but a return is in a nested loop, so it would not work.

Another note is that return std::make_tuple(...) can be changed to return {...} from c++14 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4387.html. The first version was written in this style but it tripped on xenial.

@lbonn lbonn merged commit d6bc3f3 into master Feb 21, 2020
@lbonn lbonn deleted the feat/OTA-4422/secondary-wait-timeout branch February 21, 2020 09:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants