itamae 1.0.0.beta27 → 1.0.0.beta28
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/itamae/backend.rb +1 -1
- data/lib/itamae/resource/file.rb +7 -0
- data/lib/itamae/resource/package.rb +11 -2
- data/lib/itamae/resource/user.rb +7 -1
- data/lib/itamae/version.txt +1 -1
- data/spec/integration/default_spec.rb +4 -0
- data/spec/integration/recipes/default.rb +13 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 710ad7e0b74c9481270f46dbd3770667d7f976b1
|
4
|
+
data.tar.gz: 87341f1c3733b3bc88733013fb3f3dd620ef7adc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ed18ecbf3dfd0f0ba72b6112c07712f23c386e698a42601e925454c0841469c08b60fbc978f2587206f5f8edb2ff1bc3ef5e1e8d7d469ef0b04a5128457d360
|
7
|
+
data.tar.gz: 6a9e781b54749f87d0c4c9f35add213d302ec133dde426697a650d1c0697d87a5a9b0d4d9c7d9e634fef40abbb9e6de1c5d9613029c4ebd9bebc9c7f74586b20
|
data/lib/itamae/backend.rb
CHANGED
@@ -78,7 +78,7 @@ module Itamae
|
|
78
78
|
{"stdout" => result.stdout, "stderr" => result.stderr}.each_pair do |name, value|
|
79
79
|
next unless value && value != ''
|
80
80
|
|
81
|
-
if value.bytesize > 1024
|
81
|
+
if value.bytesize > 1024 * 1024
|
82
82
|
Logger.public_send(method, " #{name} is suppressed because it's too large")
|
83
83
|
next
|
84
84
|
end
|
data/lib/itamae/resource/file.rb
CHANGED
@@ -6,6 +6,7 @@ module Itamae
|
|
6
6
|
define_attribute :action, default: :install
|
7
7
|
define_attribute :name, type: String, default_name: true
|
8
8
|
define_attribute :version, type: String
|
9
|
+
define_attribute :options, type: String
|
9
10
|
|
10
11
|
def set_current_attributes
|
11
12
|
installed = run_specinfra(:check_package_is_installed, name)
|
@@ -22,8 +23,16 @@ module Itamae
|
|
22
23
|
|
23
24
|
def install_action
|
24
25
|
unless run_specinfra(:check_package_is_installed, name, version)
|
25
|
-
|
26
|
-
|
26
|
+
if %w!ubuntu debian!.include?(backend.os[:family])
|
27
|
+
# TODO: delegate to Specinfra
|
28
|
+
package_name = name
|
29
|
+
package_name += "=#{version}" if version
|
30
|
+
run_command("DEBIAN_FRONTEND='noninteractive' apt-get -y #{options} install #{shell_escape(package_name)}")
|
31
|
+
updated!
|
32
|
+
else
|
33
|
+
run_specinfra(:install_package, name, version)
|
34
|
+
updated!
|
35
|
+
end
|
27
36
|
end
|
28
37
|
end
|
29
38
|
end
|
data/lib/itamae/resource/user.rb
CHANGED
@@ -58,7 +58,13 @@ module Itamae
|
|
58
58
|
end
|
59
59
|
|
60
60
|
def current_password
|
61
|
-
run_command("cat /etc/shadow | grep -E
|
61
|
+
result = run_command("cat /etc/shadow | grep -E ^#{shell_escape(username)}:", error: false)
|
62
|
+
|
63
|
+
if result.exit_status == 0
|
64
|
+
result.stdout.split(":")[1]
|
65
|
+
else
|
66
|
+
nil
|
67
|
+
end
|
62
68
|
end
|
63
69
|
end
|
64
70
|
end
|
data/lib/itamae/version.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.0.
|
1
|
+
1.0.0.beta28
|
@@ -107,7 +107,9 @@ execute "ps -C cron > /tmp/cron_running; true"
|
|
107
107
|
|
108
108
|
######
|
109
109
|
|
110
|
-
package "nginx"
|
110
|
+
package "nginx" do
|
111
|
+
options "--force-yes"
|
112
|
+
end
|
111
113
|
|
112
114
|
service "nginx" do
|
113
115
|
action [:enable, :start]
|
@@ -158,3 +160,13 @@ execute "echo 'notify to resource in default2.rb'" do
|
|
158
160
|
notifies :create, "file[put file in default2.rb]"
|
159
161
|
end
|
160
162
|
|
163
|
+
#####
|
164
|
+
|
165
|
+
file "/tmp/should_not_exist" do
|
166
|
+
action :create
|
167
|
+
end
|
168
|
+
|
169
|
+
file "/tmp/should_not_exist" do
|
170
|
+
action :delete
|
171
|
+
end
|
172
|
+
|