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 99def get_updates ( upgrade_option )
1010 apt_updates = nil
1111 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" )
1313 unless apt_get_result . nil?
1414 apt_updates = [ [ ] , [ ] ]
1515 apt_get_result . each_line do |line |
Original file line number Diff line number Diff line change 142142 $sourcelist = epp(' apt/source.list.epp' , {
143143 ' comment' => $comment ,
144144 ' includes' => $includes ,
145- ' options' => delete_undef_values( {
145+ ' options' => delete_undef_values({
146146 ' arch' => $architecture ,
147147 ' trusted' => $allow_unsigned ? { true => ' yes' , false => undef },
148148 ' allow-insecure' => $allow_insecure ? { true => ' yes' , false => undef },
Original file line number Diff line number Diff line change 2727 before ( :each ) do
2828 allow ( Facter . fact ( :osfamily ) ) . to receive ( :value ) . once . and_return ( 'Debian' )
2929 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
3131 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' )
3333 apt_output = "Inst extremetuxracer [2015f-0+deb8u1] (2015g-0+deb8u1 Debian:stable-updates [all])\n " \
3434 "Conf extremetuxracer (2015g-0+deb8u1 Debian:stable-updates [all])\n " \
3535 "Inst planet.rb [13-1.1] (22-2~bpo8+1 Debian Backports:stretch-backports [all])\n " \
3636 "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 )
3838 end
3939 it { is_expected . to be true }
4040 end
Original file line number Diff line number Diff line change 1818 before ( :each ) do
1919 allow ( Facter . fact ( :osfamily ) ) . to receive ( :value ) . and_return ( 'Debian' )
2020 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
2222 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' )
2424 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 )
2626 end
2727
2828 describe 'on Debian' do
Original file line number Diff line number Diff line change 1818 before ( :each ) do
1919 allow ( Facter . fact ( :osfamily ) ) . to receive ( :value ) . and_return ( 'Debian' )
2020 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
2222 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' )
2424 allow ( File ) . to receive ( :executable? ) . with ( '/usr/bin/apt-get' ) . and_return ( true )
2525 apt_output = "Inst extremetuxracer [2015f-0+deb8u1] (2015g-0+deb8u1 Debian:stable-updates [all])\n " \
2626 "Conf extremetuxracer (2015g-0+deb8u1 Debian:stable-updates [all])\n " \
2727 "Inst planet.rb [13-1.1] (22-2~bpo8+1 Debian Backports:-backports [all])\n " \
2828 "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 )
3030 end
3131 it { is_expected . to eq ( [ 'extremetuxracer' , 'planet.rb' ] ) }
3232 end
Original file line number Diff line number Diff line change 1818 before ( :each ) do
1919 allow ( Facter . fact ( :osfamily ) ) . to receive ( :value ) . and_return ( 'Debian' )
2020 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
2222 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' )
2424 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 )
2626 end
2727
2828 describe 'on Debian' do
Original file line number Diff line number Diff line change 1818 before ( :each ) do
1919 allow ( Facter . fact ( :osfamily ) ) . to receive ( :value ) . and_return ( 'Debian' )
2020 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
2222 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' )
2424 allow ( File ) . to receive ( :executable? ) . with ( '/usr/bin/apt-get' ) . and_return ( true )
2525 apt_output = "Inst extremetuxracer [2015f-0+deb8u1] (2015g-0+deb8u1 Debian:stable-updates [all])\n " \
2626 "Conf extremetuxracer (2015g-0+deb8u1 Debian:stable-updates [all])\n " \
2727 "Inst planet.rb [13-1.1] (22-2~bpo8+1 Debian Backports:-backports [all])\n " \
2828 "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 )
3030 end
3131 it { is_expected . to eq ( 2 ) }
3232 end
Original file line number Diff line number Diff line change 2727 before ( :each ) do
2828 allow ( Facter . fact ( :osfamily ) ) . to receive ( :value ) . and_return ( 'Debian' )
2929 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
3131 allow ( File ) . to receive ( :executable? ) . with ( '/usr/bin/apt-get' ) . and_return ( true )
3232 apt_output = "Inst tzdata [2015f-0+deb8u1] (2015g-0+deb8u1 Debian:stable-updates [all])\n " \
3333 "Conf tzdata (2015g-0+deb8u1 Debian:stable-updates [all])\n " \
3434 "Inst unhide.rb [13-1.1] (22-2~bpo8+1 Debian Backports:-backports [all])\n " \
3535 "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 )
3737 end
3838 it { is_expected . to be true }
3939 end
Original file line number Diff line number Diff line change 1818 before ( :each ) do
1919 allow ( Facter . fact ( :osfamily ) ) . to receive ( :value ) . and_return ( 'Debian' )
2020 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
2222 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 )
2424 end
2525
2626 describe 'on Debian' do
Original file line number Diff line number Diff line change 1818 before ( :each ) do
1919 allow ( Facter . fact ( :osfamily ) ) . to receive ( :value ) . and_return ( 'Debian' )
2020 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
2222 allow ( File ) . to receive ( :executable? ) . with ( '/usr/bin/apt-get' ) . and_return ( true )
2323 apt_output = "Inst tzdata [2015f-0+deb8u1] (2015g-0+deb8u1 Debian:stable-updates [all])\n " \
2424 "Conf tzdata (2015g-0+deb8u1 Debian:stable-updates [all])\n " \
2525 "Inst unhide.rb [13-1.1] (22-2~bpo8+1 Debian Backports:-backports [all])\n " \
2626 "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 )
2828 end
2929 it { is_expected . to eq ( [ 'tzdata' , 'unhide.rb' ] ) }
3030 end
You can’t perform that action at this time.
0 commit comments