specinfra 2.83.4 → 2.84.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/specinfra/command/amazon/v2022/package.rb +31 -0
- data/lib/specinfra/command/amazon/v2022/port.rb +5 -0
- data/lib/specinfra/command/amazon/v2022/service.rb +5 -0
- data/lib/specinfra/command/amazon/v2022/yumrepo.rb +11 -0
- data/lib/specinfra/command/amazon/v2022.rb +2 -0
- data/lib/specinfra/command.rb +7 -0
- data/lib/specinfra/version.rb +1 -1
- data/spec/command/amazon2022/package_spec.rb +32 -0
- data/spec/command/amazon2022/port_spec.rb +8 -0
- data/spec/command/amazon2022/service_spec.rb +32 -0
- data/spec/command/amazon2022/yumrepo_spec.rb +12 -0
- metadata +15 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8409581baad2004ebb1c11e01d99598c39d5b5b4
|
4
|
+
data.tar.gz: b5febfb1b4f1130c379811b680669132ea5ea556
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9292019070312c7ce37faad96381f175be5c56f7ec733d2776ab265ed75ada52f6f6c859b06fbc564def43c0f7bfd7633fe0bc5ee41ece8dd2acb6c75e92fc12
|
7
|
+
data.tar.gz: d950653eb89b474c57b183a390e3d2f218915c8077b6da4ee592e32aeec83b031978cfa041365d51697fe27249f1db8121ac2e9c2fca86560bd680000e15166e
|
@@ -0,0 +1,31 @@
|
|
1
|
+
class Specinfra::Command::Amazon::V2022::Package < Specinfra::Command::Linux::Base::Package
|
2
|
+
class << self
|
3
|
+
def check_is_installed(package, version=nil)
|
4
|
+
cmd = "rpm -q #{escape(package)}"
|
5
|
+
if version
|
6
|
+
full_package = "#{package}-#{version}"
|
7
|
+
cmd = "#{cmd} | grep -w -- #{Regexp.escape(full_package)}"
|
8
|
+
end
|
9
|
+
cmd
|
10
|
+
end
|
11
|
+
|
12
|
+
alias :check_is_installed_by_rpm :check_is_installed
|
13
|
+
|
14
|
+
def get_version(package, opts=nil)
|
15
|
+
"rpm -q --qf '%{VERSION}-%{RELEASE}' #{package}"
|
16
|
+
end
|
17
|
+
|
18
|
+
def install(package, version=nil, option='')
|
19
|
+
if version
|
20
|
+
full_package = "#{package}-#{version}"
|
21
|
+
else
|
22
|
+
full_package = package
|
23
|
+
end
|
24
|
+
cmd = "dnf -y #{option} install #{escape(full_package)}"
|
25
|
+
end
|
26
|
+
|
27
|
+
def remove(package, option='')
|
28
|
+
"dnf -y #{option} remove #{package}"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class Specinfra::Command::Amazon::V2022::Yumrepo < Specinfra::Command::Redhat::Base::Yumrepo
|
2
|
+
class << self
|
3
|
+
def check_exists(repository)
|
4
|
+
"dnf repolist all | grep -qsE \"^[\\!\\*]?#{escape(repository)}\(\\s\|$\|\\/)\""
|
5
|
+
end
|
6
|
+
|
7
|
+
def check_is_enabled(repository)
|
8
|
+
"dnf repolist enabled | grep -qs \"^[\\!\\*]\\?#{escape(repository)}\""
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/lib/specinfra/command.rb
CHANGED
@@ -127,6 +127,13 @@ require 'specinfra/command/amazon/v2'
|
|
127
127
|
require 'specinfra/command/amazon/v2/service'
|
128
128
|
require 'specinfra/command/amazon/v2/port'
|
129
129
|
|
130
|
+
# Amazon Linux V2022 (inherit RedHat)
|
131
|
+
require 'specinfra/command/amazon/v2022'
|
132
|
+
require 'specinfra/command/amazon/v2022/package'
|
133
|
+
require 'specinfra/command/amazon/v2022/port'
|
134
|
+
require 'specinfra/command/amazon/v2022/service'
|
135
|
+
require 'specinfra/command/amazon/v2022/yumrepo'
|
136
|
+
|
130
137
|
# AIX (inherit Base)
|
131
138
|
require 'specinfra/command/aix'
|
132
139
|
require 'specinfra/command/aix/base'
|
data/lib/specinfra/version.rb
CHANGED
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
property[:os] = nil
|
4
|
+
set :os, :family => 'amazon', :release => '2022'
|
5
|
+
|
6
|
+
describe get_command(:check_package_is_installed, 'telnet') do
|
7
|
+
it { should eq 'rpm -q telnet' }
|
8
|
+
end
|
9
|
+
|
10
|
+
describe get_command(:check_package_is_installed, 'telnet', '0.17-48.el6.x86_64') do
|
11
|
+
it { should eq 'rpm -q telnet | grep -w -- telnet\\-0\\.17\\-48\\.el6\\.x86_64' }
|
12
|
+
end
|
13
|
+
|
14
|
+
describe get_command(:check_package_is_installed, 'linux-headers-$(uname -r)') do
|
15
|
+
it 'should be escaped (that is, command substitution should not work' do
|
16
|
+
should eq 'rpm -q linux-headers-\\$\\(uname\\ -r\\)'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe get_command(:install_package, 'telnet') do
|
21
|
+
it { should eq "dnf -y install telnet" }
|
22
|
+
end
|
23
|
+
|
24
|
+
describe get_command(:install_package, 'telnet', '0.17-48.el6.x86_64') do
|
25
|
+
it { should eq "dnf -y install telnet-0.17-48.el6.x86_64" }
|
26
|
+
end
|
27
|
+
|
28
|
+
describe get_command(:install_package, 'linux-headers-$(uname -r)') do
|
29
|
+
it 'should be escaped (that is, command substitution should no work)' do
|
30
|
+
should eq "dnf -y install linux-headers-\\$\\(uname\\ -r\\)"
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
property[:os] = nil
|
4
|
+
set :os, :family => 'amazon', :release => '2022'
|
5
|
+
|
6
|
+
describe get_command(:enable_service, 'httpd') do
|
7
|
+
it { should eq 'systemctl enable httpd' }
|
8
|
+
end
|
9
|
+
|
10
|
+
describe get_command(:disable_service, 'httpd') do
|
11
|
+
it { should eq 'systemctl disable httpd' }
|
12
|
+
end
|
13
|
+
|
14
|
+
describe get_command(:start_service, 'httpd') do
|
15
|
+
it { should eq 'systemctl start httpd' }
|
16
|
+
end
|
17
|
+
|
18
|
+
describe get_command(:stop_service, 'httpd') do
|
19
|
+
it { should eq 'systemctl stop httpd' }
|
20
|
+
end
|
21
|
+
|
22
|
+
describe get_command(:restart_service, 'httpd') do
|
23
|
+
it { should eq 'systemctl restart httpd' }
|
24
|
+
end
|
25
|
+
|
26
|
+
describe get_command(:reload_service, 'httpd') do
|
27
|
+
it { should eq 'systemctl reload httpd' }
|
28
|
+
end
|
29
|
+
|
30
|
+
describe get_command(:enable_service, 'sshd.socket') do
|
31
|
+
it { should eq 'systemctl enable sshd.socket' }
|
32
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
property[:os] = nil
|
4
|
+
set :os, :family => 'amazon', :release => '2022'
|
5
|
+
|
6
|
+
describe get_command(:check_yumrepo_exists, 'epel') do
|
7
|
+
it { should eq "dnf repolist all | grep -qsE \"^[\\!\\*]?epel\(\\s\|$\|\\/)\"" }
|
8
|
+
end
|
9
|
+
|
10
|
+
describe get_command(:check_yumrepo_is_enabled, 'epel') do
|
11
|
+
it { should eq "dnf repolist enabled | grep -qs \"^[\\!\\*]\\?epel\"" }
|
12
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: specinfra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.84.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gosuke Miyashita
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-scp
|
@@ -170,6 +170,11 @@ files:
|
|
170
170
|
- lib/specinfra/command/amazon/v2.rb
|
171
171
|
- lib/specinfra/command/amazon/v2/port.rb
|
172
172
|
- lib/specinfra/command/amazon/v2/service.rb
|
173
|
+
- lib/specinfra/command/amazon/v2022.rb
|
174
|
+
- lib/specinfra/command/amazon/v2022/package.rb
|
175
|
+
- lib/specinfra/command/amazon/v2022/port.rb
|
176
|
+
- lib/specinfra/command/amazon/v2022/service.rb
|
177
|
+
- lib/specinfra/command/amazon/v2022/yumrepo.rb
|
173
178
|
- lib/specinfra/command/arch.rb
|
174
179
|
- lib/specinfra/command/arch/base.rb
|
175
180
|
- lib/specinfra/command/arch/base/package.rb
|
@@ -513,6 +518,10 @@ files:
|
|
513
518
|
- spec/command/amazon/service_spec.rb
|
514
519
|
- spec/command/amazon2/port_spec.rb
|
515
520
|
- spec/command/amazon2/service_spec.rb
|
521
|
+
- spec/command/amazon2022/package_spec.rb
|
522
|
+
- spec/command/amazon2022/port_spec.rb
|
523
|
+
- spec/command/amazon2022/service_spec.rb
|
524
|
+
- spec/command/amazon2022/yumrepo_spec.rb
|
516
525
|
- spec/command/base/file_spec.rb
|
517
526
|
- spec/command/base/group_spec.rb
|
518
527
|
- spec/command/base/host_spec.rb
|
@@ -656,6 +665,10 @@ test_files:
|
|
656
665
|
- spec/command/amazon/service_spec.rb
|
657
666
|
- spec/command/amazon2/port_spec.rb
|
658
667
|
- spec/command/amazon2/service_spec.rb
|
668
|
+
- spec/command/amazon2022/package_spec.rb
|
669
|
+
- spec/command/amazon2022/port_spec.rb
|
670
|
+
- spec/command/amazon2022/service_spec.rb
|
671
|
+
- spec/command/amazon2022/yumrepo_spec.rb
|
659
672
|
- spec/command/base/file_spec.rb
|
660
673
|
- spec/command/base/group_spec.rb
|
661
674
|
- spec/command/base/host_spec.rb
|