specinfra 2.90.0 → 2.91.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 067d190ae11b7f8fe5c498d4ff1ede90d0fb31a61433949aa36bc15451694385
4
- data.tar.gz: 5c9e782c260030df5eab0731ce69ee76d6282992706ba9babd3b20f92a6437f0
3
+ metadata.gz: 97394d4373eb3883902aa11db2af73d48f90fd12fcce2f232a6f343c8909b41b
4
+ data.tar.gz: a0c5cdead4225a5e8d35989a07ac009414835ff215d98bf47e5da0c2404f3caf
5
5
  SHA512:
6
- metadata.gz: fb85dc153cb2b1f09e7cc3fa3a2e08ddb0512814df16b5ef74a644a76ede812667ca2f9dbcaae54d5f1e271d185b3f31ab36647d0cbad3d4cf238184b271cdf2
7
- data.tar.gz: 8b149adf18beb0647e019580851ba742698593db56ae8e671a858f6310ef9cd6febe4225b7a11a880a8dadd97c67abe5954dc59238da7b532b065dcdab242aa3
6
+ metadata.gz: cee153ac43581df36767f934669cee337c5320c7dac025bb16bb538fddacee7a79877a4e95875087cb48f43de04c2accae6efcf3333f16b167ae5e386acdbf78
7
+ data.tar.gz: 3b9d90ccc47adb67253d09b4f8cb5c20b9610e0871981818222f862844008f33f625f8d8322b8c03ded7583b2d2bda33e5264c29830bfa9af06d44f942de335e
@@ -0,0 +1,11 @@
1
+ module Specinfra
2
+ module Command
3
+ module Module
4
+ module Runit
5
+ include Specinfra::Command::Module::Service::Runit
6
+ extend Specinfra::Command::Module::Service::Delegator
7
+ def_delegator_service_under :runit
8
+ end
9
+ end
10
+ end
11
+ end
@@ -10,6 +10,30 @@ module Specinfra
10
10
  def check_is_enabled_under_runit(service)
11
11
  "test ! -f /etc/sv/#{escape(service)}/down"
12
12
  end
13
+
14
+ def enable_under_runit(service)
15
+ "ln -s /etc/sv/#{service} /var/service/"
16
+ end
17
+
18
+ def disable_under_runit(service)
19
+ "rm /var/service/#{service}"
20
+ end
21
+
22
+ def start_under_runit(service)
23
+ "sv up /var/service/#{service}"
24
+ end
25
+
26
+ def stop_under_runit(service)
27
+ "sv down /var/service/#{service}"
28
+ end
29
+
30
+ def restart_under_runit(service)
31
+ "sv restart /var/service/#{service}"
32
+ end
33
+
34
+ def reload_under_runit(service)
35
+ "sv reload /var/service/#{service}"
36
+ end
13
37
  end
14
38
  end
15
39
  end
@@ -0,0 +1,21 @@
1
+ class Specinfra::Command::Voidlinux::Base::Package < Specinfra::Command::Linux::Base::Package
2
+ class << self
3
+ def check_is_installed(package, version=nil)
4
+ "xbps-query -S #{escape(package)} | grep -q 'state: installed'"
5
+ end
6
+
7
+ alias :check_is_installed_by_xbps :check_is_installed
8
+
9
+ def get_version(package, opts=nil)
10
+ "xbps-query -S #{package} | sed -nE 's/^pkgver: #{package}-([^\)+])/\1/p'"
11
+ end
12
+
13
+ def install(package, version=nil, option='')
14
+ "xbps-install --yes #{package}"
15
+ end
16
+
17
+ def remove(package, option='')
18
+ "xbps-remove --yes #{option} #{package}"
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,5 @@
1
+ class Specinfra::Command::Voidlinux::Base::Service < Specinfra::Command::Linux::Base::Service
2
+ class << self
3
+ include Specinfra::Command::Module::Runit
4
+ end
5
+ end
@@ -0,0 +1,2 @@
1
+ class Specinfra::Command::Voidlinux::Base < Specinfra::Command::Linux::Base
2
+ end
@@ -0,0 +1,2 @@
1
+ class Specinfra::Command::Voidlinux < Specinfra::Command::Linux
2
+ end
@@ -19,6 +19,7 @@ require 'specinfra/command/module/systemd'
19
19
  require 'specinfra/command/module/zfs'
20
20
  require 'specinfra/command/module/ss'
21
21
  require 'specinfra/command/module/openrc'
22
+ require 'specinfra/command/module/runit'
22
23
 
23
24
  # Base
24
25
  require 'specinfra/command/base'
@@ -407,3 +408,9 @@ require 'specinfra/command/poky/base/interface'
407
408
  require 'specinfra/command/poky/base/inventory'
408
409
  require 'specinfra/command/poky/base/package'
409
410
  require 'specinfra/command/poky/base/service'
411
+
412
+ # VoidLinux (inherit Linux)
413
+ require 'specinfra/command/voidlinux'
414
+ require 'specinfra/command/voidlinux/base'
415
+ require 'specinfra/command/voidlinux/base/package'
416
+ require 'specinfra/command/voidlinux/base/service'
@@ -0,0 +1,11 @@
1
+ class Specinfra::Helper::DetectOs::Voidlinux < Specinfra::Helper::DetectOs
2
+ def detect
3
+ if run_command("ls /etc/os-release").success?
4
+ line = run_command("cat /etc/os-release").stdout
5
+
6
+ if line =~ /^ID="void"/
7
+ { :family => 'voidlinux', :release => nil }
8
+ end
9
+ end
10
+ end
11
+ end
@@ -40,3 +40,4 @@ require 'specinfra/helper/detect_os/poky'
40
40
  require 'specinfra/helper/detect_os/redhat'
41
41
  require 'specinfra/helper/detect_os/solaris'
42
42
  require 'specinfra/helper/detect_os/suse'
43
+ require 'specinfra/helper/detect_os/voidlinux'
@@ -1,5 +1,5 @@
1
1
  module Specinfra
2
- VERSION = "2.90.0"
2
+ VERSION = "2.91.0"
3
3
 
4
4
  def self.ruby_is_older_than?(*version)
5
5
  (RUBY_VERSION.split('.').map(&:to_i) <=> version) < 0
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+
3
+ describe Specinfra::Command::Module::Service::Runit do
4
+ class Specinfra::Command::Module::Service::Runit::Test < Specinfra::Command::Base
5
+ extend Specinfra::Command::Module::Service::Runit
6
+ end
7
+ let(:klass) { Specinfra::Command::Module::Service::Runit::Test }
8
+ it { expect(klass.check_is_enabled_under_runit('httpd')).to eq 'test ! -f /etc/sv/httpd/down' }
9
+ it { expect(klass.check_is_running_under_runit('httpd')).to eq "sv status httpd | grep -E '^run: '" }
10
+ it { expect(klass.enable_under_runit('httpd')).to eq 'ln -s /etc/sv/httpd /var/service/' }
11
+ it { expect(klass.disable_under_runit('httpd')).to eq 'rm /var/service/httpd' }
12
+ it { expect(klass.start_under_runit('httpd')).to eq 'sv up /var/service/httpd' }
13
+ it { expect(klass.stop_under_runit('httpd')).to eq 'sv down /var/service/httpd' }
14
+ it { expect(klass.restart_under_runit('httpd')).to eq 'sv restart /var/service/httpd' }
15
+ it { expect(klass.reload_under_runit('httpd')).to eq 'sv reload /var/service/httpd' }
16
+ end
@@ -0,0 +1,9 @@
1
+ require 'spec_helper'
2
+
3
+ require 'spec_helper'
4
+
5
+ set :os, { :family => 'voidlinux' }
6
+
7
+ describe get_command(:check_package_is_installed, 'httpd') do
8
+ it { should eq "xbps-query -S httpd | grep -q 'state: installed'" }
9
+ end
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ property[:os] = nil
4
+ set :os, :family => 'voidlinux'
5
+
6
+ describe get_command(:enable_service, 'nginx') do
7
+ it { should eq 'ln -s /etc/sv/nginx /var/service/' }
8
+ end
9
+
10
+ describe get_command(:disable_service, 'nginx') do
11
+ it { should eq 'rm /var/service/nginx' }
12
+ end
13
+
14
+ describe get_command(:start_service, 'nginx') do
15
+ it { should eq 'sv up /var/service/nginx' }
16
+ end
17
+
18
+ describe get_command(:stop_service, 'nginx') do
19
+ it { should eq 'sv down /var/service/nginx' }
20
+ end
21
+
22
+ describe get_command(:restart_service, 'nginx') do
23
+ it { should eq 'sv restart /var/service/nginx' }
24
+ end
data/specinfra.gemspec CHANGED
@@ -19,6 +19,7 @@ Gem::Specification.new do |spec|
19
19
  # TODO: at some point pin to a minumum version of ruby to reduce support burden in a major version bump
20
20
  # spec.required_ruby_version = '>= 2.3.0'
21
21
 
22
+ spec.add_runtime_dependency "base64"
22
23
  spec.add_runtime_dependency "net-scp"
23
24
  spec.add_runtime_dependency "net-ssh", ">= 2.7"
24
25
  spec.add_runtime_dependency "net-telnet" # intentionally version-unspecified for Ruby older than 2.3.0
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: specinfra
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.90.0
4
+ version: 2.91.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: 2024-07-24 00:00:00.000000000 Z
11
+ date: 2024-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: base64
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: net-scp
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -320,6 +334,7 @@ files:
320
334
  - lib/specinfra/command/linuxmint/base.rb
321
335
  - lib/specinfra/command/module.rb
322
336
  - lib/specinfra/command/module/openrc.rb
337
+ - lib/specinfra/command/module/runit.rb
323
338
  - lib/specinfra/command/module/service/daemontools.rb
324
339
  - lib/specinfra/command/module/service/delegator.rb
325
340
  - lib/specinfra/command/module/service/god.rb
@@ -436,6 +451,10 @@ files:
436
451
  - lib/specinfra/command/ubuntu/v15/service.rb
437
452
  - lib/specinfra/command/ubuntu/v18.rb
438
453
  - lib/specinfra/command/ubuntu/v18/port.rb
454
+ - lib/specinfra/command/voidlinux.rb
455
+ - lib/specinfra/command/voidlinux/base.rb
456
+ - lib/specinfra/command/voidlinux/base/package.rb
457
+ - lib/specinfra/command/voidlinux/base/service.rb
439
458
  - lib/specinfra/command/vyos.rb
440
459
  - lib/specinfra/command/vyos/base.rb
441
460
  - lib/specinfra/command/windows.rb
@@ -487,6 +506,7 @@ files:
487
506
  - lib/specinfra/helper/detect_os/redhat.rb
488
507
  - lib/specinfra/helper/detect_os/solaris.rb
489
508
  - lib/specinfra/helper/detect_os/suse.rb
509
+ - lib/specinfra/helper/detect_os/voidlinux.rb
490
510
  - lib/specinfra/helper/docker.rb
491
511
  - lib/specinfra/helper/host_inventory.rb
492
512
  - lib/specinfra/helper/lxc.rb
@@ -581,6 +601,7 @@ files:
581
601
  - spec/command/linux/selinux_spec.rb
582
602
  - spec/command/module/service/daemontools_spec.rb
583
603
  - spec/command/module/service/init_spec.rb
604
+ - spec/command/module/service/runit_spec.rb
584
605
  - spec/command/module/service/systemd_spec.rb
585
606
  - spec/command/module/ss_spec.rb
586
607
  - spec/command/module/systemd_spec.rb
@@ -604,6 +625,8 @@ files:
604
625
  - spec/command/sles15/service_spec.rb
605
626
  - spec/command/solaris11/user_spec.rb
606
627
  - spec/command/ubuntu/ppa_spec.rb
628
+ - spec/command/voidlinux/package_spec.rb
629
+ - spec/command/voidlinux/service_spec.rb
607
630
  - spec/command/windows/registry_key_spec.rb
608
631
  - spec/command/windows/service_spec.rb
609
632
  - spec/configuration_spec.rb
@@ -732,6 +755,7 @@ test_files:
732
755
  - spec/command/linux/selinux_spec.rb
733
756
  - spec/command/module/service/daemontools_spec.rb
734
757
  - spec/command/module/service/init_spec.rb
758
+ - spec/command/module/service/runit_spec.rb
735
759
  - spec/command/module/service/systemd_spec.rb
736
760
  - spec/command/module/ss_spec.rb
737
761
  - spec/command/module/systemd_spec.rb
@@ -755,6 +779,8 @@ test_files:
755
779
  - spec/command/sles15/service_spec.rb
756
780
  - spec/command/solaris11/user_spec.rb
757
781
  - spec/command/ubuntu/ppa_spec.rb
782
+ - spec/command/voidlinux/package_spec.rb
783
+ - spec/command/voidlinux/service_spec.rb
758
784
  - spec/command/windows/registry_key_spec.rb
759
785
  - spec/command/windows/service_spec.rb
760
786
  - spec/configuration_spec.rb