Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable RO proposal in case of error #483

Merged
merged 10 commits into from
Jan 16, 2017
Merged

Enable RO proposal in case of error #483

merged 10 commits into from
Jan 16, 2017

Conversation

mchf
Copy link
Member

@mchf mchf commented Dec 19, 2016

https://trello.com/c/sEVjWKcJ/780-3-casp-read-only-software-selection

Proposals in control file currently have format:

<proposal_module>
  <name>software</name>
  <read_only config:type="boolean">true</read_only>
</proposal_module>

this PR changes this to

<proposal_module>
  <name>software</name>
  <!-- soft means that proposal becomes active when an error happens,
         hard means that proposal is always RO -->
  <read_only>soft</read_only>
</proposal_module>

@read_only_proposals[:hard] << name
when "soft"
@read_only_proposals[:soft] << name
end
Copy link
Member

Choose a reason for hiding this comment

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

The else branch is missing, it should at least log the unknown value. It would be better to put it in one of the list otherwise it will be completely lost. Probably the :soft is a good default as it allows user to fix a possible issue without locking him out.

def read_only?(client)
read_only_proposals.include?(client)
# @return [Boolean] if the client is marked as "hard" read only
def read_only_no_recovery?(client)
Copy link
Member

Choose a reason for hiding this comment

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

I think hard_read_only? and soft_read_only? names would sound better and better match the description.

Mon Dec 19 13:23:12 UTC 2016 - mfilka@suse.com

- Made user's interaction possible in case of error in read-only
proposal.
Copy link
Member

Choose a reason for hiding this comment

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

Add a FATE reference.

@mvidner
Copy link
Member

mvidner commented Dec 19, 2016

This only makes sense when other pieces of the puzzle are present, but there are no references to them

  • bnc/fate
  • trello
  • other PRs

#
# @param [String] client
# @return [Boolean] if the client is marked as "hard" read only
def read_only_no_recovery?(client)
Copy link
Member

Choose a reason for hiding this comment

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

I think hard_read_only? and soft_read_only? names would sound better and better match the description.

@mvidner
Copy link
Member

mvidner commented Dec 19, 2016

In particular, I am missing the logic that says: "an error has in fact occurred so let's make a read-only part modifiable now".


case proposal["read_only"]
when "hard"
@read_only_proposals[:hard] << name
Copy link
Member

Choose a reason for hiding this comment

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

There is an inconsistency with the PR description, it lists <read_only>soft</read_only> config option (which is a string), here in the code is :hard symbol.

Either change the code to "hard" or change the configuration to <read_only config:type="symbol">soft</read_only>.

Copy link
Member

Choose a reason for hiding this comment

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

No, it's OK. The condition uses a string.

Copy link
Member

Choose a reason for hiding this comment

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

Oh, I overlooked that, OK...

Copy link
Member

@lslezak lslezak left a comment

Choose a reason for hiding this comment

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

Please add new unit tests and adjust the existing tests (they use the old boolean value), see https://github.com/yast/yast-installation/blob/SLE-12-SP2-CASP/test/proposal_store_test.rb#L566

@@ -807,7 +807,7 @@ def html_header(submod)
title = @store.title_for(submod)

# do not add a link if the module is read-only or link is already included
heading = if @store.read_only?(submod) || title.include?("<a")
heading = if @store.hard_read_only?(submod) || title.include?("<a")
Copy link
Member

Choose a reason for hiding this comment

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

It seems it does not handle the soft read only case correctly. For soft RO the proposal should be RO, RW only when there is an error. The error state for the soft case is not handled at all here.

@mchf
Copy link
Member Author

mchf commented Dec 19, 2016

There is no need to adjust old testsuite. read_only? still exists and still use boolean.

@lslezak
Copy link
Member

lslezak commented Dec 19, 2016

I see, then please add new test for the added functionality.

And Travis fails because of cannot load such file -- y2country/widgets (LoadError), no idea why...

@lslezak
Copy link
Member

lslezak commented Dec 19, 2016

OK, this looks better, thanks!

expect_any_instance_of(::Installation::ProposalRunner)
.to receive(:submod_descriptions_and_build_menu)
.and_return(false)
expect_any_instance_of(::Installation::ProposalStore)
Copy link
Member

Choose a reason for hiding this comment

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

The test is OK, but as you mock most (all?) of the ::Installation::ProposalStore functionality it would be nice to add also some tests to https://github.com/mchf/yast-installation/blob/ae795f1094d361c5db76aace03776951e6923323/test/proposal_store_test.rb#L566, esp. for the soft RO case. TIA!

@lslezak
Copy link
Member

lslezak commented Dec 20, 2016

Almost there... 😉

Please add also a test with soft RO and an error state. (Check that the header is clickable and the client can be called.)

@mchf
Copy link
Member Author

mchf commented Dec 20, 2016

Related PR: yast/yast-installation-control#33

@mchf
Copy link
Member Author

mchf commented Dec 20, 2016

Related PR: yast/skelcd-control-CAASP#16

Copy link
Member

@lslezak lslezak left a comment

Choose a reason for hiding this comment

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

LGTM

}

it "makes a proposal" do
allow(subject)
Copy link
Member

Choose a reason for hiding this comment

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

NP: I'd a comment here that this is needed to allow the other calls than the one expected later, otherwise it looks a bit confusing...

Copy link
Member

@lslezak lslezak left a comment

Choose a reason for hiding this comment

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

Sorry, Travis fails... (A Rubocop issue + 1 test failure)

@mchf
Copy link
Member Author

mchf commented Jan 11, 2017

ok, I'll wait for #485, rebase and then we will see.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 7351a47 on mchf:ro_sw into ** on yast:SLE-12-SP2-CASP**.

@lslezak
Copy link
Member

lslezak commented Jan 13, 2017

Please remove the last commit (Use Docker at Travis), I have fixed a packaging issue in the Travis packages. It works now.

@mchf
Copy link
Member Author

mchf commented Jan 13, 2017

@lslezak thanks, last commit removed. However the build this time failed in jenkins (seems like an accessibility issue)

@lslezak
Copy link
Member

lslezak commented Jan 16, 2017

We can ignore the Jenkins failure, it tries to build against CASP in IBS which cannot work from the public Jenkins. Moreover after switching to Docker at Travis we do not this Jenkins job anymore

@mchf
Copy link
Member Author

mchf commented Jan 16, 2017

Thanks for reviews

@mchf mchf merged commit 3a552da into yast:SLE-12-SP2-CASP Jan 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants