itchy 0.2.2 → 0.2.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
  SHA1:
3
- metadata.gz: 0bf5bee7dc7a6e337e10fc9bd285a38727c93a9c
4
- data.tar.gz: b71427e6b12ffc838f36e73341d6132b178da2e7
3
+ metadata.gz: d34b3f182cd7b8448019d19750207a0d4c756779
4
+ data.tar.gz: 8c1c95b92299172ceec21f88f3a3cacae89a5a5b
5
5
  SHA512:
6
- metadata.gz: 554a8ae5197b46344545375a1f914fc86e0fa670731838c1f42d30e9de5aed25b30b53e260c8fca1f77c643f1bb51e0c3d10fe1e932e05094e919919220bd133
7
- data.tar.gz: 705a1717610cf8586dad54f01e0f42e873c8003895b42e75cac2f34be7bcf1ef15cce564a78189a72614a1385811fdb6f30c07204a94def08f2e524bef9dc9a2
6
+ metadata.gz: 717b601424734dd320d2edb950d961254c65dfd41e6b40ed7da777308cbe1ba84d4410f648ff203d6ab072e892cfaf9177cdc4600a0b69e4c9ed653b4f8ce630
7
+ data.tar.gz: bd9e0c13b9a74463a187985d02e71a24090a4abb4585d2aa076d3c28585000cf73c48e0f7f20deb2430f94bcfba53dc7eea5b5748606d52f7b09cbc6206be9db
data/bin/itchy CHANGED
@@ -79,6 +79,8 @@ class ItchyRunnable < Thor
79
79
  aliases: '-o', desc: 'Path to a directory where processed events descriptors will be stored'
80
80
  method_option :descriptor_dir, type: :string, default: Itchy::Settings.descriptor_dir,
81
81
  aliases: '-e', desc: 'Path to a directory where appliance descriptors will be stored'
82
+ method_option :file_permissions, type: :string, default: Itchy::Settings['permissions']['file'],
83
+ aliases: '-p', desc: 'Sets permissions for all created files'
82
84
  method_option *shared_option_log_to
83
85
  method_option *shared_option_log_level
84
86
  method_option *shared_option_debug
data/config/itchy.yml CHANGED
@@ -6,6 +6,8 @@ defaults: &defaults
6
6
  log_to: stderr
7
7
  log_level: error
8
8
  debug: false
9
+ permissions:
10
+ file: '0660'
9
11
  output_image_format: qcow2
10
12
  qemu_img_binary: /usr/bin/qemu-img
11
13
 
@@ -13,6 +13,8 @@ module Itchy::EventHandlers
13
13
  image_transformer_instance = Itchy::ImageTransformer.new(@options)
14
14
  new_file_name = image_transformer_instance.transform!(vmcatcher_event, vmcatcher_configuration)
15
15
  save_descriptor(create_descriptor(vmcatcher_event, new_file_name), event_name)
16
+ # file permissions for image
17
+ set_file_permissions(File.join(@options.output_dir, new_file_name))
16
18
  rescue Itchy::Errors::PrepareEnvError, ArgumentError, Itchy::Errors::ImageTransformationError => ex
17
19
  Itchy::Log.error "[#{self.class.name}] Problem with handling event #{event_name}" \
18
20
  "Event handling failed with #{ex.message}"
@@ -54,7 +54,7 @@ module Itchy::EventHandlers
54
54
  unless vmcatcher_event.is_a?(Itchy::VmcatcherEvent)
55
55
  fail ArgumentError, '\'vmcatcher_event\' must be an instance of ' \
56
56
  'Itchy::VmcatcherEvent!'
57
- end
57
+ end
58
58
  end
59
59
 
60
60
  # Save created descriptor to descriptor directory.
@@ -69,6 +69,19 @@ module Itchy::EventHandlers
69
69
  "Attempt failed with error #{ex.message}"
70
70
  fail Itchy::Errors::PrepareEnvError, ex
71
71
  end
72
+ # file permissions for descriptor
73
+ set_file_permissions(File.join(@options.descriptor_dir, File.basename(name)))
74
+ end
75
+
76
+ def set_file_permissions(file)
77
+ Itchy::Log.debug "[#{self.class.name}] Setting file permissions for file #{file} to #{@options.file_permissions}."
78
+
79
+ begin
80
+ ::FileUtils.chmod @options.file_permissions.to_i(8), file
81
+ rescue SystemCallError => ex
82
+ Itchy::Log.error 'Failed to set permissions!!!'
83
+ fail Itchy::Errors::PrepareEnvError, ex
84
+ end
72
85
  end
73
86
 
74
87
  protected
@@ -64,7 +64,7 @@ module Itchy
64
64
 
65
65
  # Creates VmcatcherEvent instance.
66
66
  #
67
- # @param json json [String] path to file containing json representation
67
+ # @param json [String] path to file containing json representation
68
68
  # of vmcatcher event
69
69
  #
70
70
  # @return [VmcatcherEvent] instance representing event
data/lib/itchy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Itchy
2
- VERSION = '0.2.2' unless defined?(::Itchy::VERSION)
2
+ VERSION = '0.2.3' unless defined?(::Itchy::VERSION)
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itchy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lubomir Kosaristan
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-01-20 00:00:00.000000000 Z
12
+ date: 2016-02-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: opennebula