vagrant-guests-clearlinux 1.1.2 → 1.1.3

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: dfa5f951d32b52a569a44c55a878f37f39183a39634037301e3118ff9346814e
4
- data.tar.gz: 95eb0ab44c67df88572012361b8a18d6a21cdb5cf746b8c1bfe3125b8b814860
3
+ metadata.gz: 5b9d8c743e3f93bfb55681f1e0ec2a6f310b9ff1b272b45b6ea6f61ad2bf288a
4
+ data.tar.gz: 4999fa0b253f5ef51dadcab9ae46b817aefd40989ce2acf33534d52de98887a8
5
5
  SHA512:
6
- metadata.gz: cd6b8a1f6126c0cdc75effb2b7f58200ec3186458d35a2de754f148478e177064d73575ba17a3895fe9c5a8dd75749034e834814e02bba2329c58d68e08927c3
7
- data.tar.gz: 86423cc5cbd49f48f81e1958d30478519698b68ea82af7c683b7ffb37bea7ca4a5ae8ea146c8d1912d849a1cba260d80239843e229611c8c00020377e85ffb52
6
+ metadata.gz: 1d95b74340a5f14029d16dcbe70a09ecef94d40abb04dcac0ca409c0c956600d6f689c81a5d34bf390e681710a837e2ba9e7bd01f9f77d4788faaf9f413c2bdd
7
+ data.tar.gz: 14213d4c582e24ce1c822747789d524c2c1af2115e9bcf26c1048a120ad57aca1152be12bf358329aa838a6ea3586e6d0c8ec2f450a396b02af060406b3790db
data/README.md CHANGED
@@ -11,32 +11,45 @@ Currently the plugin exposes the following *guest*
11
11
  - **[NFS](https://www.vagrantup.com/docs/synced-folders/nfs.html)**
12
12
 
13
13
  Beyond adding proper **[Clear Linux](https://clearlinux.org)** *guest* support to **Vagrant** this
14
- plugin also comes bundled with a simple
15
- **[provisioner](https://www.vagrantup.com/docs/provisioning/)** in order to enable basic
14
+ plugin also comes bundled two additional **[provisioners](https://www.vagrantup.com/docs/provisioning/)**:
15
+
16
+ - a simple **[provisioner](https://www.vagrantup.com/docs/provisioning/)** that
17
+ enable basics
16
18
  **[swupd](https://clearlinux.org/documentation/clear-linux/guides/maintenance/swupd-guide)**
17
19
  operations straight from the `Vagrantfile`:
18
20
 
19
- - adding one or more **[bundles](https://clearlinux.org/documentation/clear-linux/reference/bundles)**
21
+ - adding one or more **[bundles](https://clearlinux.org/documentation/clear-linux/reference/bundles)**
20
22
 
21
- ```ruby
22
- config.vm.provision :bundle_add, bundles: 'wireshark'
23
- # alternatively ... functionally equivalent to above
24
- # config.vm.provision :bundle_add do |p|
25
- # p.bundles = 'wireshark'
26
- # end
27
- ```
23
+ ```ruby
24
+ config.vm.provision :bundle_add, bundles: 'wireshark'
25
+ # alternatively ... functionally equivalent to above
26
+ # config.vm.provision :bundle_add do |p|
27
+ # p.bundles = 'wireshark'
28
+ # end
29
+ ```
30
+
31
+ - removing one or more **[bundles](https://clearlinux.org/documentation/clear-linux/reference/bundles)**
28
32
 
29
- - removing one or more **[bundles](https://clearlinux.org/documentation/clear-linux/reference/bundles)**
33
+ ```ruby
34
+ # assuming it was installed already ...
35
+ config.vm.provision :bundle_remove, bundles: [ 'wireshark', 'nmap' ]
36
+ # alternatively ... functionally equivalent to above
37
+ # config.vm.provision :bundle_remove do |p|
38
+ # p.bundles = ['wireshark', 'nmap']
39
+ # end
40
+ ```
41
+
42
+ - a provisioner to set the desired [timezone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)
43
+
44
+ Given that the available ClearLinux boxes ship with a default timezone set unlikely
45
+ to suit everyone (Author's one `Portugal` *aka* `Europe/Lisbon`) here's how to programatically your own straight from the `Vagrantfile`:
30
46
 
31
47
  ```ruby
32
- # assuming it was installed already ...
33
- config.vm.provision :bundle_remove, bundles: [ 'wireshark', 'nmap' ]
34
- # alternatively ... functionally equivalent to above
35
- # config.vm.provision :bundle_remove do |p|
36
- # p.bundles = ['wireshark', 'nmap']
37
- # end
48
+ config.vm.provision :set_timezone, timezone: 'Asia/Dili'
38
49
  ```
39
50
 
51
+ > `Vagrant` loading will abort if the provided timezone is invalid
52
+
40
53
  ## Compatible Vagrant boxes
41
54
 
42
55
  The **Clear Linux** Vagrant **[boxes](https://app.vagrantup.com/AntonioMeireles/boxes/ClearLinux)** come
@@ -17,6 +17,10 @@ module VagrantPlugins
17
17
  require_relative 'provisioner'
18
18
  BundlesConfig
19
19
  end
20
+ config(:set_timezone, :provisioner) do
21
+ require_relative 'provisioner'
22
+ TimezoneConfig
23
+ end
20
24
 
21
25
  provisioner(:bundle_add) do
22
26
  require_relative 'provisioner'
@@ -28,6 +32,10 @@ module VagrantPlugins
28
32
  BundleRemoveProvisioner
29
33
  end
30
34
 
35
+ provisioner(:set_timezone) do
36
+ require_relative 'provisioner'
37
+ TimezoneProvisioner
38
+ end
31
39
  guest('clearlinux', 'linux') do
32
40
  require_relative 'guest'
33
41
  Guest
@@ -2,6 +2,7 @@
2
2
  # Copyright (c) 2019 António Meireles. All Rights Reserved.
3
3
 
4
4
  require 'vagrant'
5
+ require 'tzinfo'
5
6
 
6
7
  module VagrantPlugins
7
8
  module GuestClearLinux
@@ -26,6 +27,51 @@ module VagrantPlugins
26
27
  end
27
28
  end
28
29
 
30
+ class TimezoneConfig < Vagrant.plugin('2', :config)
31
+ attr_accessor :timezone
32
+
33
+ def initialize
34
+ super
35
+ @timezone = UNSET_VALUE
36
+ end
37
+
38
+ def finalize!
39
+ super
40
+ @timezone = '' if @timezone == UNSET_VALUE
41
+ end
42
+
43
+ def validate(machine)
44
+ errors = _detected_errors
45
+
46
+ TZInfo::Timezone.get(timezone)
47
+ { "vm.provision.set_timezone:" => errors }
48
+ rescue TZInfo::InvalidTimezoneIdentifier
49
+ errors << "Invalid (user provided) timezone: '#{timezone}', Aborting!"
50
+
51
+ { "vm.provision.set_timezone:" => errors }
52
+ end
53
+
54
+ def timezone=(timezone)
55
+ @timezone = timezone
56
+ end
57
+ end
58
+
59
+ class TimezoneProvisioner < Vagrant.plugin('2', :provisioner)
60
+ def provision
61
+ @machine.ui.detail("setting (user provided) timezone to '#{@config.timezone}'")
62
+ @machine.communicate.sudo("timedatectl set-timezone #{@config.timezone}") do |type, data|
63
+ if [:stderr, :stdout].include?(type)
64
+ color = type == :stdout ? :green : :red
65
+
66
+ options = {}
67
+ options[:color] = color
68
+
69
+ @machine.ui.detail(data.chomp, options)
70
+ end
71
+ end
72
+ end
73
+ end
74
+
29
75
  class BundleAddProvisioner < Vagrant.plugin('2', :provisioner)
30
76
  def provision
31
77
  @machine.ui.detail("installing the following bundle(s): '#{@config.bundles}'")
@@ -4,6 +4,6 @@
4
4
  module VagrantPlugins
5
5
  # Set version for vagrant-guests-clearlinux gem.
6
6
  module GuestClearLinux
7
- VERSION = '1.1.2'
7
+ VERSION = '1.1.3'
8
8
  end
9
9
  end
@@ -1,5 +1,5 @@
1
1
  # encoding: UTF-8
2
- # Copyright (c) 2018 António Meireles. All Rights Reserved.
2
+ # Copyright (c) 2018-2019 António Meireles. All Rights Reserved.
3
3
  $LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
4
4
  require 'vagrant-guests-clearlinux/version'
5
5
 
@@ -21,6 +21,9 @@ Gem::Specification.new do |s|
21
21
  s.add_development_dependency 'rspec-mocks', '~> 3.5.0'
22
22
  s.add_development_dependency 'rubocop'
23
23
 
24
+ s.add_dependency 'tzinfo'
25
+ s.add_dependency 'tzinfo-data'
26
+
24
27
  s.files = `git ls-files`.split($RS)
25
28
  s.executables = s.files.grep(/^bin/) { |f| File.basename(f) }
26
29
  s.test_files = s.files.grep(/^(test|spec|features)/)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-guests-clearlinux
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - António Meireles
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-08 00:00:00.000000000 Z
11
+ date: 2019-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -94,6 +94,34 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: tzinfo
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: tzinfo-data
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
97
125
  description: Enables Vagrant to manage Clear Linux guests.
98
126
  email: antonio.meireles@reformi.st
99
127
  executables: []