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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f71dbe4da1c49cacda9dac2d10c5c1cb0263e6b4
4
- data.tar.gz: 09480bb0d8624135546598f390cabd30428b8ce0
3
+ metadata.gz: 710ad7e0b74c9481270f46dbd3770667d7f976b1
4
+ data.tar.gz: 87341f1c3733b3bc88733013fb3f3dd620ef7adc
5
5
  SHA512:
6
- metadata.gz: 4238df2db65e2f9a66d5a0021d724e0e1d1f2234f97b62b4e3fab49f8560e92150124221b2a755f450cf782a919e3ad121ae3a8179021eaeba59eaed9fb08d18
7
- data.tar.gz: ada64866b96afadc1f916e3a4b106e9e4f59acc8c01e5797e6c86f26988a5b6af207d97de8d09e5ee25816c8e31ad4ad6b49f4abcafe4bbb54395e3c5110ca0f
6
+ metadata.gz: 9ed18ecbf3dfd0f0ba72b6112c07712f23c386e698a42601e925454c0841469c08b60fbc978f2587206f5f8edb2ff1bc3ef5e1e8d7d469ef0b04a5128457d360
7
+ data.tar.gz: 6a9e781b54749f87d0c4c9f35add213d302ec133dde426697a650d1c0697d87a5a9b0d4d9c7d9e634fef40abbb9e6de1c5d9613029c4ebd9bebc9c7f74586b20
@@ -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
@@ -75,6 +75,13 @@ module Itamae
75
75
 
76
76
  run_specinfra(:move_file, @temppath, path)
77
77
  end
78
+
79
+ def delete_action
80
+ if run_specinfra(:check_file_is_file, path)
81
+ # TODO: delegate to Specinfra
82
+ run_command(["rm", path])
83
+ end
84
+ end
78
85
  end
79
86
  end
80
87
  end
@@ -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
- run_specinfra(:install_package, name, version)
26
- updated!
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
@@ -58,7 +58,13 @@ module Itamae
58
58
  end
59
59
 
60
60
  def current_password
61
- run_command("cat /etc/shadow | grep -E ^itamae:").stdout.split(":")[1]
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
@@ -1 +1 @@
1
- 1.0.0.beta27
1
+ 1.0.0.beta28
@@ -97,3 +97,7 @@ describe file('/tmp/created_in_default2') do
97
97
  it { should be_file }
98
98
  end
99
99
 
100
+ describe file('/tmp/should_not_exist') do
101
+ it { should_not be_file }
102
+ end
103
+
@@ -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
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itamae
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.beta27
4
+ version: 1.0.0.beta28
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryota Arai