File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33source 'https://rubygems.org'
44
55gem 'rake'
6- gem 'serverspec'
6+ gem 'serverspec' , '~> 2.3.0'
77gem 'rubocop' , '~> 0.23'
8+ gem 'highline' , '~> 1.6.0'
Original file line number Diff line number Diff line change 1717
1818require 'spec_helper'
1919
20- RSpec . configure do |c |
21- c . filter_run_excluding skipOn : backend ( Serverspec ::Commands ::Base ) . check_os [ :family ]
22- end
23-
2420
2521describe command ( 'find / -name \'.rhosts\' | wc -l ' ) do
2622 its ( :stdout ) { should match ( /^0/ ) }
Original file line number Diff line number Diff line change 2222 require 'net/ssh'
2323 require 'highline/import'
2424
25- include Serverspec ::Helper ::Ssh
26- include Serverspec ::Helper ::DetectOS
25+ set :backend , :ssh
2726
2827 RSpec . configure do |c |
2928
4241 end
4342
4443 if ENV [ 'ASK_LOGIN_USERNAME' ]
45- user = ask ( "\n Enter login username: " ) { |q | q . echo = false }
44+ options [ : user] = ask ( "\n Enter login username: " ) { |q | q . echo = false }
4645 else
47- user = ENV [ 'LOGIN_USERNAME' ] || ENV [ 'user' ] || Etc . getlogin
46+ options [ : user] = ENV [ 'LOGIN_USERNAME' ] || ENV [ 'user' ] || Etc . getlogin
4847 end
4948
50- if user . nil?
49+ if options [ : user] . nil?
5150 puts 'specify login user env LOGIN_USERNAME= or user='
5251 exit 1
5352 end
5453
55- c . host = ENV [ 'TARGET_HOST' ]
56- options . merge ( Net ::SSH ::Config . for ( c . host ) )
57- c . ssh = Net ::SSH . start ( c . host , user , options )
58- c . os = backend . check_os
54+ c . host = ENV [ 'TARGET_HOST' ]
55+ c . ssh_options = options . merge ( Net ::SSH ::Config . for ( c . host ) )
5956
6057 end
6158
6259else
6360 require 'serverspec'
6461
65- include Serverspec ::Helper ::Exec
66- include Serverspec ::Helper ::DetectOS
62+ set :backend , :exec
6763
6864 RSpec . configure do |c |
6965 c . before :all do
Original file line number Diff line number Diff line change 1717
1818require 'spec_helper'
1919
20- RSpec . configure do |c |
21- c . filter_run_excluding skipOn : backend ( Serverspec ::Commands ::Base ) . check_os [ :family ]
22- end
23-
2420describe 'IP V4 networking' do
2521
2622
204200
205201
206202 # check if we find the nx flag
207- if command ( 'cat /proc/cpuinfo' ) . return_stdout? ( /^flags.*?:.*? nx( .*?)?$/ )
203+ if command ( 'cat /proc/cpuinfo' ) . stdout =~ /^flags.*?:.*? nx( .*?)?$/
208204 true
209205 else
210206 # if no nx flag is present, we require exec-shield
Original file line number Diff line number Diff line change 1717
1818require 'spec_helper'
1919
20- RSpec . configure do |c |
21- c . filter_run_excluding skipOn : backend ( Serverspec ::Commands ::Base ) . check_os [ :family ]
22- end
23-
2420
2521describe command ( 'find / -name \'.rhosts\' | wc -l ' ) do
2622 its ( :stdout ) { should match ( /^0/ ) }
Original file line number Diff line number Diff line change 2222 require 'net/ssh'
2323 require 'highline/import'
2424
25- include Serverspec ::Helper ::Ssh
26- include Serverspec ::Helper ::DetectOS
25+ set :backend , :ssh
2726
2827 RSpec . configure do |c |
2928
4241 end
4342
4443 if ENV [ 'ASK_LOGIN_USERNAME' ]
45- user = ask ( "\n Enter login username: " ) { |q | q . echo = false }
44+ options [ : user] = ask ( "\n Enter login username: " ) { |q | q . echo = false }
4645 else
47- user = ENV [ 'LOGIN_USERNAME' ] || ENV [ 'user' ] || Etc . getlogin
46+ options [ : user] = ENV [ 'LOGIN_USERNAME' ] || ENV [ 'user' ] || Etc . getlogin
4847 end
4948
50- if user . nil?
49+ if options [ : user] . nil?
5150 puts 'specify login user env LOGIN_USERNAME= or user='
5251 exit 1
5352 end
5453
55- c . host = ENV [ 'TARGET_HOST' ]
56- options . merge ( Net ::SSH ::Config . for ( c . host ) )
57- c . ssh = Net ::SSH . start ( c . host , user , options )
58- c . os = backend . check_os
54+ c . host = ENV [ 'TARGET_HOST' ]
55+ c . ssh_options = options . merge ( Net ::SSH ::Config . for ( c . host ) )
5956
6057 end
6158
6259else
6360 require 'serverspec'
6461
65- include Serverspec ::Helper ::Exec
66- include Serverspec ::Helper ::DetectOS
62+ set :backend , :exec
6763
6864 RSpec . configure do |c |
6965 c . before :all do
Original file line number Diff line number Diff line change 1717
1818require 'spec_helper'
1919
20- RSpec . configure do |c |
21- c . filter_run_excluding skipOn : backend ( Serverspec ::Commands ::Base ) . check_os [ :family ]
22- end
23-
2420describe 'IP V4 networking' do
2521
2622
You can’t perform that action at this time.
0 commit comments