mirror of
				https://github.com/saltstack-formulas/openssh-formula.git
				synced 2025-11-04 11:13:31 +01:00 
			
		
		
		
	feat(test): remove serverspec files
All tests provided by Serverspec are covered by Inspec.
This commit is contained in:
		
							parent
							
								
									d0d2864d13
								
							
						
					
					
						commit
						049db2bc8e
					
				@ -1,36 +0,0 @@
 | 
				
			|||||||
require 'serverspec'
 | 
					 | 
				
			||||||
set :backend, :exec
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
def service_name()
 | 
					 | 
				
			||||||
  return case os[:family]
 | 
					 | 
				
			||||||
    when 'debian', 'ubuntu' then 'ssh'
 | 
					 | 
				
			||||||
    else 'sshd'
 | 
					 | 
				
			||||||
  end
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
def root_group()
 | 
					 | 
				
			||||||
  return case os[:family]
 | 
					 | 
				
			||||||
    when 'freebsd' then 'wheel'
 | 
					 | 
				
			||||||
    else 'root'
 | 
					 | 
				
			||||||
  end
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
describe 'openssl/config.sls' do
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  describe service(service_name()) do
 | 
					 | 
				
			||||||
    it { should be_running }
 | 
					 | 
				
			||||||
  end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  describe file('/etc/ssh/sshd_config') do
 | 
					 | 
				
			||||||
    it { should be_mode 600 }
 | 
					 | 
				
			||||||
    it { should be_owned_by 'root' }
 | 
					 | 
				
			||||||
    it { should be_grouped_into root_group() }
 | 
					 | 
				
			||||||
  end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  describe file('/etc/ssh/ssh_config') do
 | 
					 | 
				
			||||||
    it { should be_mode 644 }
 | 
					 | 
				
			||||||
    it { should be_owned_by 'root' }
 | 
					 | 
				
			||||||
    it { should be_grouped_into root_group() }
 | 
					 | 
				
			||||||
  end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
@ -1,81 +0,0 @@
 | 
				
			|||||||
# -*- coding: utf-8 -*-
 | 
					 | 
				
			||||||
# vim: ft=ruby
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Global source defined as https://rubygems.org
 | 
					 | 
				
			||||||
source 'https://rubygems.org'
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Attempt to fingerprint OS from /etc/os-release where available
 | 
					 | 
				
			||||||
if File.file?("/etc/os-release")
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  os_family = ''
 | 
					 | 
				
			||||||
  os_version = ''
 | 
					 | 
				
			||||||
  os_version_full = ''
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  # Strip necessary granularity from os-release
 | 
					 | 
				
			||||||
  File.open("/etc/os-release").grep(/(^ID=(.*)$|^VERSION="(.*)"$|^VERSION_ID="(.*)")/) do |line|
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      # OS family (Debian/CentOS/Ubuntu)
 | 
					 | 
				
			||||||
      if ( line =~ /^ID=\S/ )
 | 
					 | 
				
			||||||
        os_family = line.split('=')[1]
 | 
					 | 
				
			||||||
        puts "IDENTIFIED os_family = " + os_family
 | 
					 | 
				
			||||||
      end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      # Major revision
 | 
					 | 
				
			||||||
      if ( line =~ /^VERSION_ID="(.*)"$/ )
 | 
					 | 
				
			||||||
        os_version = line.split('=')[1].tr('"','')
 | 
					 | 
				
			||||||
        puts "IDENTIFIED os_version = " + os_version
 | 
					 | 
				
			||||||
      end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      # Vanity name
 | 
					 | 
				
			||||||
      if ( line =~ /^VERSION="(.*)"$/ )
 | 
					 | 
				
			||||||
        os_version_full = line.split('=')[1]
 | 
					 | 
				
			||||||
        puts "IDENTIFIED os_version_full = " + os_version_full
 | 
					 | 
				
			||||||
      end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  # Pinning is broken into os_family and then os_version
 | 
					 | 
				
			||||||
  # to try and avoid conflict.
 | 
					 | 
				
			||||||
  case os_family
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    when /debian/
 | 
					 | 
				
			||||||
      # os_family: Debian os_version dependent pins
 | 
					 | 
				
			||||||
      case os_version
 | 
					 | 
				
			||||||
        when /7/
 | 
					 | 
				
			||||||
          puts "busser-serverspec is no longer natively supported on: " + os_version_full
 | 
					 | 
				
			||||||
        when /8/
 | 
					 | 
				
			||||||
          gem 'net-ssh', '~> 4.2.0'
 | 
					 | 
				
			||||||
        else
 | 
					 | 
				
			||||||
          puts "Your distribution is either too old, or supported without pins: " + os_version_full
 | 
					 | 
				
			||||||
      end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    when /centos/
 | 
					 | 
				
			||||||
      # os_family: centos os_version dependent pins
 | 
					 | 
				
			||||||
      print "Switching on " + os_version
 | 
					 | 
				
			||||||
      case os_version
 | 
					 | 
				
			||||||
        when /6/
 | 
					 | 
				
			||||||
          puts "busser-serverspec has no native supported on: " + os_version_full
 | 
					 | 
				
			||||||
        when /7/
 | 
					 | 
				
			||||||
          gem 'net-ssh', '~> 4.2.0'
 | 
					 | 
				
			||||||
        else
 | 
					 | 
				
			||||||
          puts "Your distribution is either too old, or supported without pins: " + os_version_full
 | 
					 | 
				
			||||||
      end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    when /ubuntu/
 | 
					 | 
				
			||||||
      # os_family: ubuntu os_version dependent pins
 | 
					 | 
				
			||||||
      case os_version
 | 
					 | 
				
			||||||
        when /14.04/
 | 
					 | 
				
			||||||
          puts "busser-serverspec is no longer natively supported on: " + os_version_full
 | 
					 | 
				
			||||||
        when /16.04/
 | 
					 | 
				
			||||||
          puts "busser-serverspec is currently supported natively on: " + os_version_full
 | 
					 | 
				
			||||||
        else
 | 
					 | 
				
			||||||
          puts "Your distribution is either too old, or supported without pins: " + os_version_full
 | 
					 | 
				
			||||||
      end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # No helper support provided
 | 
					 | 
				
			||||||
    else
 | 
					 | 
				
			||||||
      puts "No Gemfile helper support exists for os_family: " + os_family
 | 
					 | 
				
			||||||
  end
 | 
					 | 
				
			||||||
else
 | 
					 | 
				
			||||||
  puts "No Gemfile helper support provided for this suite."
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user