File tree Expand file tree Collapse file tree 12 files changed +27
-27
lines changed Expand file tree Collapse file tree 12 files changed +27
-27
lines changed Original file line number Diff line number Diff line change 9
9
def get_updates ( upgrade_option )
10
10
apt_updates = nil
11
11
if File . executable? ( '/usr/bin/apt-get' )
12
- apt_get_result = Facter ::Util :: Resolution . exec ( "/usr/bin/apt-get -s -o Debug::NoLocking=true #{ upgrade_option } 2>&1" )
12
+ apt_get_result = Facter ::Core :: Execution . execute ( "/usr/bin/apt-get -s -o Debug::NoLocking=true #{ upgrade_option } 2>&1" )
13
13
unless apt_get_result . nil?
14
14
apt_updates = [ [ ] , [ ] ]
15
15
apt_get_result . each_line do |line |
Original file line number Diff line number Diff line change 142
142
$sourcelist = epp(' apt/source.list.epp' , {
143
143
' comment' => $comment ,
144
144
' includes' => $includes ,
145
- ' options' => delete_undef_values( {
145
+ ' options' => delete_undef_values({
146
146
' arch' => $architecture ,
147
147
' trusted' => $allow_unsigned ? { true => ' yes' , false => undef },
148
148
' allow-insecure' => $allow_insecure ? { true => ' yes' , false => undef },
Original file line number Diff line number Diff line change 27
27
before ( :each ) do
28
28
allow ( Facter . fact ( :osfamily ) ) . to receive ( :value ) . once . and_return ( 'Debian' )
29
29
allow ( File ) . to receive ( :executable? ) # Stub all other calls
30
- allow ( Facter ::Util :: Resolution ) . to receive ( :exec ) # Catch all other calls
30
+ allow ( Facter ::Core :: Execution ) . to receive ( :execute ) # Catch all other calls
31
31
allow ( File ) . to receive ( :executable? ) . with ( '/usr/bin/apt-get' ) . and_return ( true )
32
- allow ( Facter ::Util :: Resolution ) . to receive ( :exec ) . with ( '/usr/bin/apt-get -s -o Debug::NoLocking=true upgrade 2>&1' ) . and_return ( 'test' )
32
+ allow ( Facter ::Core :: Execution ) . to receive ( :execute ) . with ( '/usr/bin/apt-get -s -o Debug::NoLocking=true upgrade 2>&1' ) . and_return ( 'test' )
33
33
apt_output = "Inst extremetuxracer [2015f-0+deb8u1] (2015g-0+deb8u1 Debian:stable-updates [all])\n " \
34
34
"Conf extremetuxracer (2015g-0+deb8u1 Debian:stable-updates [all])\n " \
35
35
"Inst planet.rb [13-1.1] (22-2~bpo8+1 Debian Backports:stretch-backports [all])\n " \
36
36
"Conf planet.rb (22-2~bpo8+1 Debian Backports:stretch-backports [all])\n "
37
- allow ( Facter ::Util :: Resolution ) . to receive ( :exec ) . with ( '/usr/bin/apt-get -s -o Debug::NoLocking=true dist-upgrade 2>&1' ) . and_return ( apt_output )
37
+ allow ( Facter ::Core :: Execution ) . to receive ( :execute ) . with ( '/usr/bin/apt-get -s -o Debug::NoLocking=true dist-upgrade 2>&1' ) . and_return ( apt_output )
38
38
end
39
39
it { is_expected . to be true }
40
40
end
Original file line number Diff line number Diff line change 18
18
before ( :each ) do
19
19
allow ( Facter . fact ( :osfamily ) ) . to receive ( :value ) . and_return ( 'Debian' )
20
20
allow ( File ) . to receive ( :executable? ) # Stub all other calls
21
- allow ( Facter ::Util :: Resolution ) . to receive ( :exec ) # Catch all other calls
21
+ allow ( Facter ::Core :: Execution ) . to receive ( :execute ) # Catch all other calls
22
22
allow ( File ) . to receive ( :executable? ) . with ( '/usr/bin/apt-get' ) . and_return ( true )
23
- allow ( Facter ::Util :: Resolution ) . to receive ( :exec ) . with ( '/usr/bin/apt-get -s -o Debug::NoLocking=true upgrade 2>&1' ) . and_return ( 'test' )
23
+ allow ( Facter ::Core :: Execution ) . to receive ( :execute ) . with ( '/usr/bin/apt-get -s -o Debug::NoLocking=true upgrade 2>&1' ) . and_return ( 'test' )
24
24
allow ( File ) . to receive ( :executable? ) . with ( '/usr/bin/apt-get' ) . and_return ( true )
25
- allow ( Facter ::Util :: Resolution ) . to receive ( :exec ) . with ( '/usr/bin/apt-get -s -o Debug::NoLocking=true dist-upgrade 2>&1' ) . and_return ( apt_get_upgrade_output )
25
+ allow ( Facter ::Core :: Execution ) . to receive ( :execute ) . with ( '/usr/bin/apt-get -s -o Debug::NoLocking=true dist-upgrade 2>&1' ) . and_return ( apt_get_upgrade_output )
26
26
end
27
27
28
28
describe 'on Debian' do
Original file line number Diff line number Diff line change 18
18
before ( :each ) do
19
19
allow ( Facter . fact ( :osfamily ) ) . to receive ( :value ) . and_return ( 'Debian' )
20
20
allow ( File ) . to receive ( :executable? ) # Stub all other calls
21
- allow ( Facter ::Util :: Resolution ) . to receive ( :exec ) # Catch all other calls
21
+ allow ( Facter ::Core :: Execution ) . to receive ( :execute ) # Catch all other calls
22
22
allow ( File ) . to receive ( :executable? ) . with ( '/usr/bin/apt-get' ) . and_return ( true )
23
- allow ( Facter ::Util :: Resolution ) . to receive ( :exec ) . with ( '/usr/bin/apt-get -s -o Debug::NoLocking=true upgrade 2>&1' ) . and_return ( 'test' )
23
+ allow ( Facter ::Core :: Execution ) . to receive ( :execute ) . with ( '/usr/bin/apt-get -s -o Debug::NoLocking=true upgrade 2>&1' ) . and_return ( 'test' )
24
24
allow ( File ) . to receive ( :executable? ) . with ( '/usr/bin/apt-get' ) . and_return ( true )
25
25
apt_output = "Inst extremetuxracer [2015f-0+deb8u1] (2015g-0+deb8u1 Debian:stable-updates [all])\n " \
26
26
"Conf extremetuxracer (2015g-0+deb8u1 Debian:stable-updates [all])\n " \
27
27
"Inst planet.rb [13-1.1] (22-2~bpo8+1 Debian Backports:-backports [all])\n " \
28
28
"Conf planet.rb (22-2~bpo8+1 Debian Backports:-backports [all])\n "
29
- allow ( Facter ::Util :: Resolution ) . to receive ( :exec ) . with ( '/usr/bin/apt-get -s -o Debug::NoLocking=true dist-upgrade 2>&1' ) . and_return ( apt_output )
29
+ allow ( Facter ::Core :: Execution ) . to receive ( :execute ) . with ( '/usr/bin/apt-get -s -o Debug::NoLocking=true dist-upgrade 2>&1' ) . and_return ( apt_output )
30
30
end
31
31
it { is_expected . to eq ( [ 'extremetuxracer' , 'planet.rb' ] ) }
32
32
end
Original file line number Diff line number Diff line change 18
18
before ( :each ) do
19
19
allow ( Facter . fact ( :osfamily ) ) . to receive ( :value ) . and_return ( 'Debian' )
20
20
allow ( File ) . to receive ( :executable? ) # Stub all other calls
21
- allow ( Facter ::Util :: Resolution ) . to receive ( :exec ) # Catch all other calls
21
+ allow ( Facter ::Core :: Execution ) . to receive ( :execute ) # Catch all other calls
22
22
allow ( File ) . to receive ( :executable? ) . with ( '/usr/bin/apt-get' ) . and_return ( true )
23
- allow ( Facter ::Util :: Resolution ) . to receive ( :exec ) . with ( '/usr/bin/apt-get -s -o Debug::NoLocking=true upgrade 2>&1' ) . and_return ( 'test' )
23
+ allow ( Facter ::Core :: Execution ) . to receive ( :execute ) . with ( '/usr/bin/apt-get -s -o Debug::NoLocking=true upgrade 2>&1' ) . and_return ( 'test' )
24
24
allow ( File ) . to receive ( :executable? ) . with ( '/usr/bin/apt-get' ) . and_return ( true )
25
- allow ( Facter ::Util :: Resolution ) . to receive ( :exec ) . with ( '/usr/bin/apt-get -s -o Debug::NoLocking=true dist-upgrade 2>&1' ) . and_return ( apt_get_upgrade_output )
25
+ allow ( Facter ::Core :: Execution ) . to receive ( :execute ) . with ( '/usr/bin/apt-get -s -o Debug::NoLocking=true dist-upgrade 2>&1' ) . and_return ( apt_get_upgrade_output )
26
26
end
27
27
28
28
describe 'on Debian' do
Original file line number Diff line number Diff line change 18
18
before ( :each ) do
19
19
allow ( Facter . fact ( :osfamily ) ) . to receive ( :value ) . and_return ( 'Debian' )
20
20
allow ( File ) . to receive ( :executable? ) # Stub all other calls
21
- allow ( Facter ::Util :: Resolution ) . to receive ( :exec ) # Catch all other calls
21
+ allow ( Facter ::Core :: Execution ) . to receive ( :execute ) # Catch all other calls
22
22
allow ( File ) . to receive ( :executable? ) . with ( '/usr/bin/apt-get' ) . and_return ( true )
23
- allow ( Facter ::Util :: Resolution ) . to receive ( :exec ) . with ( '/usr/bin/apt-get -s -o Debug::NoLocking=true upgrade 2>&1' ) . and_return ( 'test' )
23
+ allow ( Facter ::Core :: Execution ) . to receive ( :execute ) . with ( '/usr/bin/apt-get -s -o Debug::NoLocking=true upgrade 2>&1' ) . and_return ( 'test' )
24
24
allow ( File ) . to receive ( :executable? ) . with ( '/usr/bin/apt-get' ) . and_return ( true )
25
25
apt_output = "Inst extremetuxracer [2015f-0+deb8u1] (2015g-0+deb8u1 Debian:stable-updates [all])\n " \
26
26
"Conf extremetuxracer (2015g-0+deb8u1 Debian:stable-updates [all])\n " \
27
27
"Inst planet.rb [13-1.1] (22-2~bpo8+1 Debian Backports:-backports [all])\n " \
28
28
"Conf planet.rb (22-2~bpo8+1 Debian Backports:-backports [all])\n "
29
- allow ( Facter ::Util :: Resolution ) . to receive ( :exec ) . with ( '/usr/bin/apt-get -s -o Debug::NoLocking=true dist-upgrade 2>&1' ) . and_return ( apt_output )
29
+ allow ( Facter ::Core :: Execution ) . to receive ( :execute ) . with ( '/usr/bin/apt-get -s -o Debug::NoLocking=true dist-upgrade 2>&1' ) . and_return ( apt_output )
30
30
end
31
31
it { is_expected . to eq ( 2 ) }
32
32
end
Original file line number Diff line number Diff line change 27
27
before ( :each ) do
28
28
allow ( Facter . fact ( :osfamily ) ) . to receive ( :value ) . and_return ( 'Debian' )
29
29
allow ( File ) . to receive ( :executable? ) # Stub all other calls
30
- allow ( Facter ::Util :: Resolution ) . to receive ( :exec ) # Catch all other calls
30
+ allow ( Facter ::Core :: Execution ) . to receive ( :execute ) # Catch all other calls
31
31
allow ( File ) . to receive ( :executable? ) . with ( '/usr/bin/apt-get' ) . and_return ( true )
32
32
apt_output = "Inst tzdata [2015f-0+deb8u1] (2015g-0+deb8u1 Debian:stable-updates [all])\n " \
33
33
"Conf tzdata (2015g-0+deb8u1 Debian:stable-updates [all])\n " \
34
34
"Inst unhide.rb [13-1.1] (22-2~bpo8+1 Debian Backports:-backports [all])\n " \
35
35
"Conf unhide.rb (22-2~bpo8+1 Debian Backports:-backports [all])\n "
36
- allow ( Facter ::Util :: Resolution ) . to receive ( :exec ) . with ( '/usr/bin/apt-get -s -o Debug::NoLocking=true upgrade 2>&1' ) . and_return ( apt_output )
36
+ allow ( Facter ::Core :: Execution ) . to receive ( :execute ) . with ( '/usr/bin/apt-get -s -o Debug::NoLocking=true upgrade 2>&1' ) . and_return ( apt_output )
37
37
end
38
38
it { is_expected . to be true }
39
39
end
Original file line number Diff line number Diff line change 18
18
before ( :each ) do
19
19
allow ( Facter . fact ( :osfamily ) ) . to receive ( :value ) . and_return ( 'Debian' )
20
20
allow ( File ) . to receive ( :executable? ) # Stub all other calls
21
- allow ( Facter ::Util :: Resolution ) . to receive ( :exec ) # Catch all other calls
21
+ allow ( Facter ::Core :: Execution ) . to receive ( :execute ) # Catch all other calls
22
22
allow ( File ) . to receive ( :executable? ) . with ( '/usr/bin/apt-get' ) . and_return ( true )
23
- allow ( Facter ::Util :: Resolution ) . to receive ( :exec ) . with ( '/usr/bin/apt-get -s -o Debug::NoLocking=true upgrade 2>&1' ) . and_return ( apt_get_upgrade_output )
23
+ allow ( Facter ::Core :: Execution ) . to receive ( :execute ) . with ( '/usr/bin/apt-get -s -o Debug::NoLocking=true upgrade 2>&1' ) . and_return ( apt_get_upgrade_output )
24
24
end
25
25
26
26
describe 'on Debian' do
Original file line number Diff line number Diff line change 18
18
before ( :each ) do
19
19
allow ( Facter . fact ( :osfamily ) ) . to receive ( :value ) . and_return ( 'Debian' )
20
20
allow ( File ) . to receive ( :executable? ) # Stub all other calls
21
- allow ( Facter ::Util :: Resolution ) . to receive ( :exec ) # Catch all other calls
21
+ allow ( Facter ::Core :: Execution ) . to receive ( :execute ) # Catch all other calls
22
22
allow ( File ) . to receive ( :executable? ) . with ( '/usr/bin/apt-get' ) . and_return ( true )
23
23
apt_output = "Inst tzdata [2015f-0+deb8u1] (2015g-0+deb8u1 Debian:stable-updates [all])\n " \
24
24
"Conf tzdata (2015g-0+deb8u1 Debian:stable-updates [all])\n " \
25
25
"Inst unhide.rb [13-1.1] (22-2~bpo8+1 Debian Backports:-backports [all])\n " \
26
26
"Conf unhide.rb (22-2~bpo8+1 Debian Backports:-backports [all])\n "
27
- allow ( Facter ::Util :: Resolution ) . to receive ( :exec ) . with ( '/usr/bin/apt-get -s -o Debug::NoLocking=true upgrade 2>&1' ) . and_return ( apt_output )
27
+ allow ( Facter ::Core :: Execution ) . to receive ( :execute ) . with ( '/usr/bin/apt-get -s -o Debug::NoLocking=true upgrade 2>&1' ) . and_return ( apt_output )
28
28
end
29
29
it { is_expected . to eq ( [ 'tzdata' , 'unhide.rb' ] ) }
30
30
end
You can’t perform that action at this time.
0 commit comments