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

Services are not touched if firewalld is not enabled (bsc#1067915) #38

Merged
merged 8 commits into from
Nov 20, 2017

Conversation

teclator
Copy link
Contributor

@coveralls
Copy link

Coverage Status

Coverage increased (+2.6%) to 30.015% when pulling c54a5dc on teclator:doc_and_tests into 28dc0dd on yast:master.

.rubocop.yml Outdated

# Redundant returns add legibility for developers used to other languages
Style/RedundantReturn:
Enabled: false
Copy link
Member

Choose a reason for hiding this comment

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

btw reason sounds a bit funny. Does we add to C++ also style that makes C++ more familiar for ruby developers? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just copied the rubocop config from what I considered the newest module and only added the exclude of old yast-firewall modules because of all the complains so. So will check the other options

.rubocop.yml Outdated
Style/IfUnlessModifier:
MaxLineLength: 60

# some storage API have size method, but without empty? method
Copy link
Member

Choose a reason for hiding this comment

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

this is not storage :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hehe, nothing like use the current config of some new module and not modify comments 👎

.rubocop.yml Outdated
Style/ZeroLengthPredicate:
Enabled: false

# the ".freeze" attribute for the constants is not nice
Copy link
Member

Choose a reason for hiding this comment

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

hmm, we have this discussion also in storage and in fact, freeze is what make constant real constant

@coveralls
Copy link

Coverage Status

Coverage increased (+2.6%) to 30.015% when pulling b74ad1d on teclator:doc_and_tests into 28dc0dd on yast:master.

Metrics/CyclomaticComplexity:
Max: 10

AllCops:
Copy link
Member

Choose a reason for hiding this comment

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

this is a bit strong, but ok for me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, it is, I will remove it gradually, by now I only wanted to cover the new code.

@@ -45,15 +52,20 @@ def modes

def write
Service.Enable("sshd") if @settings.enable_sshd
@firewalld.enable! if @settings.enable_firewall

return true unless @settings.enable_firewall
Copy link
Member

Choose a reason for hiding this comment

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

so if firewall is not enabled, we did not disable it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, this client is the only one that enables the service, make sense to disable it during installation?

Copy link
Member

Choose a reason for hiding this comment

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

well, it depends if user click on disable firewall and product have it enabled by default, I expect it will be disabled.

end
end

context "and the firewall-config package is installed" do
Copy link
Member

Choose a reason for hiding this comment

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

missing case when it is not installed.

Copy link
Member

Choose a reason for hiding this comment

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

in fact it is two cases as user is asked to install it and he can install or cancel.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

true

let(:client) { described_class.new }

describe "#initialize" do
it "instantiates a new proposal settings" do
Copy link
Member

Choose a reason for hiding this comment

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

well, I think it is not needed to test that it is instantiated, as it is common ruby functionality.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

well, it is part of the code and it is public, it is a simple test but even so..

Copy link
Contributor Author

@teclator teclator Nov 16, 2017

Choose a reason for hiding this comment

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

BTW, this is really a test for lib/y2firewall/clients/proposal.rb so will move all the lib tests to a folder that really match its path

@coveralls
Copy link

Coverage Status

Coverage increased (+2.6%) to 30.015% when pulling 573531d on teclator:doc_and_tests into 28dc0dd on yast:master.


# [Boolean] Whether the firewalld service will be enable
attr_accessor :enable_firewall
Copy link
Member

Choose a reason for hiding this comment

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

as you are having more rich enable/disable variants, does it make sense to still have public enable_firewall=?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably not make sense all, is preferable to not expose it, but currently it is used in load_feature although I could just modify the public_send by an instance_variable_set in bang methods and also in some tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will try to replace in next iteration over code.

Copy link
Member

@jreidinger jreidinger left a comment

Choose a reason for hiding this comment

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

just minor note, otherwise LGTM

@teclator teclator merged commit f6c236b into yast:master Nov 20, 2017
@teclator teclator deleted the doc_and_tests branch November 20, 2017 08:49
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.

None yet

3 participants