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

(CAT-1435) Address outdated code #163

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,11 @@ class foo() {
end
end

context 'support the use of facts and trusted facts for Puppet 3.5 onwards' do
context 'support the use of facts and trusted facts' do
let(:code) do
<<-END
class foo() {
if $facts['osfamily'] == 'redhat' or $trusted['osfamily'] == 'redhat' {
if $facts['os']['family'] == 'redhat' or $trusted['os']['family'] == 'redhat' {
$redhat = true
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ class { 'some_class':
context 'where the top level of the block has no parameters' do
let(:code) do
<<-END
case $::osfamily {
case $facts['os']['family'] {
'RedHat': {
$datadir = $::operatingsystem ? {
'Amazon' => pick($datadir, 'value'),
Expand Down
64 changes: 32 additions & 32 deletions spec/unit/puppet-lint/plugins/legacy_facts/legacy_facts_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,79 +29,79 @@
context "fact variable using legacy $facts['osfamily']" do
let(:code) { "$facts['osfamily']" }

it 'onlies detect a single problem' do
it 'only detect a single problem' do
expect(problems.size).to eq(1)
end
end

context 'fact variable using legacy $::osfamily' do
let(:code) { '$::osfamily' }

it 'onlies detect a single problem' do
it 'only detect a single problem' do
expect(problems.size).to eq(1)
end
end

context 'fact variable using legacy $::blockdevice_sda_model' do
let(:code) { '$::blockdevice_sda_model' }

it 'onlies detect a single problem' do
it 'only detect a single problem' do
expect(problems.size).to eq(1)
end
end

context "fact variable using legacy $facts['ipaddress6_em2']" do
let(:code) { "$facts['ipaddress6_em2']" }

it 'onlies detect a single problem' do
it 'only detect a single problem' do
expect(problems.size).to eq(1)
end
end

context 'fact variable using legacy $::zone_foobar_uuid' do
let(:code) { '$::zone_foobar_uuid' }

it 'onlies detect a single problem' do
it 'only detect a single problem' do
expect(problems.size).to eq(1)
end
end

context 'fact variable using legacy $::processor314' do
let(:code) { '$::processor314' }

it 'onlies detect a single problem' do
it 'only detect a single problem' do
expect(problems.size).to eq(1)
end
end

context 'fact variable using legacy $::sp_l3_cache' do
let(:code) { '$::sp_l3_cache' }

it 'onlies detect a single problem' do
it 'only detect a single problem' do
expect(problems.size).to eq(1)
end
end

context 'fact variable using legacy $::sshrsakey' do
let(:code) { '$::sshrsakey' }

it 'onlies detect a single problem' do
it 'only detect a single problem' do
expect(problems.size).to eq(1)
end
end

context 'fact variable in interpolated string "${::osfamily}"' do
let(:code) { '"start ${::osfamily} end"' }

it 'onlies detect a single problem' do
it 'only detect a single problem' do
expect(problems.size).to eq(1)
end
end

context 'fact variable using legacy variable in double quotes "$::osfamily"' do
let(:code) { '"$::osfamily"' }

it 'onlies detect a single problem' do
it 'only detect a single problem' do
expect(problems.size).to eq(1)
end
end
Expand Down Expand Up @@ -168,7 +168,7 @@
let(:code) { "$facts['osfamily']" }
let(:msg) { "legacy fact 'osfamily'" }

it 'onlies detect a single problem' do
it 'only detect a single problem' do
expect(problems.size).to eq(1)
end

Expand Down Expand Up @@ -210,7 +210,7 @@
let(:code) { '$::osfamily' }
let(:msg) { "legacy fact 'osfamily'" }

it 'onlies detect a single problem' do
it 'only detect a single problem' do
expect(problems.size).to eq(1)
end

Expand All @@ -227,7 +227,7 @@
let(:code) { '$::sshrsakey' }
let(:msg) { "legacy fact 'sshrsakey'" }

it 'onlies detect a single problem' do
it 'only detect a single problem' do
expect(problems.size).to eq(1)
end

Expand All @@ -243,7 +243,7 @@
context 'fact variable using legacy $::memoryfree_mb' do
let(:code) { '$::memoryfree_mb' }

it 'onlies detect a single problem' do
it 'only detect a single problem' do
expect(problems.size).to eq(1)
end

Expand All @@ -255,7 +255,7 @@
context 'fact variable using legacy $::blockdevice_sda_model' do
let(:code) { '$::blockdevice_sda_model' }

it 'onlies detect a single problem' do
it 'only detect a single problem' do
expect(problems.size).to eq(1)
end

Expand All @@ -267,7 +267,7 @@
context "fact variable using legacy $facts['ipaddress6_em2']" do
let(:code) { "$facts['ipaddress6_em2']" }

it 'onlies detect a single problem' do
it 'only detect a single problem' do
expect(problems.size).to eq(1)
end

Expand All @@ -279,7 +279,7 @@
context 'fact variable using legacy $::zone_foobar_uuid' do
let(:code) { '$::zone_foobar_uuid' }

it 'onlies detect a single problem' do
it 'only detect a single problem' do
expect(problems.size).to eq(1)
end

Expand All @@ -291,7 +291,7 @@
context 'fact variable using legacy $::processor314' do
let(:code) { '$::processor314' }

it 'onlies detect a single problem' do
it 'only detect a single problem' do
expect(problems.size).to eq(1)
end

Expand All @@ -303,7 +303,7 @@
context 'fact variable using legacy $::sp_l3_cache' do
let(:code) { '$::sp_l3_cache' }

it 'onlies detect a single problem' do
it 'only detect a single problem' do
expect(problems.size).to eq(1)
end

Expand All @@ -315,7 +315,7 @@
context 'fact variable using legacy $::sshrsakey' do
let(:code) { '$::sshrsakey' }

it 'onlies detect a single problem' do
it 'only detect a single problem' do
expect(problems.size).to eq(1)
end

Expand All @@ -327,7 +327,7 @@
context 'fact variable in interpolated string "${::osfamily}"' do
let(:code) { '"start ${::osfamily} end"' }

it 'onlies detect a single problem' do
it 'only detect a single problem' do
expect(problems.size).to eq(1)
end

Expand All @@ -339,7 +339,7 @@
context 'fact variable using legacy variable in double quotes "$::osfamily"' do
let(:code) { '"$::osfamily"' }

it 'onlies detect a single problem' do
it 'only detect a single problem' do
expect(problems.size).to eq(1)
end

Expand All @@ -351,7 +351,7 @@
context 'fact variable using legacy variable in double quotes "$::gid"' do
let(:code) { '"$::gid"' }

it 'onlies detect a single problem' do
it 'only detect a single problem' do
expect(problems.size).to eq(1)
end

Expand All @@ -363,7 +363,7 @@
context 'fact variable using legacy variable in double quotes "$::id"' do
let(:code) { '"$::id"' }

it 'onlies detect a single problem' do
it 'only detect a single problem' do
expect(problems.size).to eq(1)
end

Expand All @@ -375,7 +375,7 @@
context 'fact variable using legacy variable in double quotes "$::lsbdistcodename"' do
let(:code) { '"$::lsbdistcodename"' }

it 'onlies detect a single problem' do
it 'only detect a single problem' do
expect(problems.size).to eq(1)
end

Expand All @@ -387,7 +387,7 @@
context 'fact variable using legacy variable in double quotes "$::lsbdistdescription"' do
let(:code) { '"$::lsbdistdescription"' }

it 'onlies detect a single problem' do
it 'only detect a single problem' do
expect(problems.size).to eq(1)
end

Expand All @@ -399,7 +399,7 @@
context 'fact variable using legacy variable in double quotes "$::lsbdistid"' do
let(:code) { '"$::lsbdistid"' }

it 'onlies detect a single problem' do
it 'only detect a single problem' do
expect(problems.size).to eq(1)
end

Expand All @@ -411,7 +411,7 @@
context 'fact variable using legacy variable in double quotes "$::lsbdistrelease"' do
let(:code) { '"$::lsbdistrelease"' }

it 'onlies detect a single problem' do
it 'only detect a single problem' do
expect(problems.size).to eq(1)
end

Expand All @@ -423,7 +423,7 @@
context 'fact variable using legacy variable in double quotes "$::lsbmajdistrelease"' do
let(:code) { '"$::lsbmajdistrelease"' }

it 'onlies detect a single problem' do
it 'only detect a single problem' do
expect(problems.size).to eq(1)
end

Expand All @@ -435,7 +435,7 @@
context 'fact variable using legacy variable in double quotes "$::lsbminordistrelease"' do
let(:code) { '"$::lsbminordistrelease"' }

it 'onlies detect a single problem' do
it 'only detect a single problem' do
expect(problems.size).to eq(1)
end

Expand All @@ -447,7 +447,7 @@
context 'fact variable using legacy variable in double quotes "$::lsbrelease"' do
let(:code) { '"$::lsbrelease"' }

it 'onlies detect a single problem' do
it 'only detect a single problem' do
expect(problems.size).to eq(1)
end

Expand All @@ -459,7 +459,7 @@
context "fact variable using facts hash in double quotes \"$facts['lsbrelease']\"" do
let(:code) { "\"${facts['lsbrelease']}\"" }

it 'onlies detect a single problem' do
it 'only detect a single problem' do
expect(problems.size).to eq(1)
end

Expand Down