cloudkeeper 1.0.0 → 1.1.1

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: e3b7552e766ed9dff94b3c02ead5b2d7457146d7
4
- data.tar.gz: 9fc5d03ddd65bd5502b9bbf7cfa716c5e5f17306
3
+ metadata.gz: 8308dade657b0c7205133fee005a1654ed07cc22
4
+ data.tar.gz: 77717083b5aa925c8918604db8e2ec1206f15c71
5
5
  SHA512:
6
- metadata.gz: 0a9273fe7503544dd2ed1749d577fbf49a8db35a7b6a9dc4f71230109000bf7e302d9b5c8050a955515b105af0dbcb48fc23a8923b06f3f4f9631cce3a020cae
7
- data.tar.gz: 69ee71cc79f047eeb8efb5a80c512285feca404c2047c178d00d563fc57aab294ba7db8873ece88cf038e966167f466ce295e783d366750801bf7e719ac56eb1
6
+ metadata.gz: 6ce76c74fddd2924369baf8c96d8f6a476110c817524e97899c8d5593e1d0d6c194f02ad05c702057b9c18186d85657304b4dd5b86cd2284d4738fb73355dd17
7
+ data.tar.gz: af8b5f351291bcae870976c19ae2fb7101719de76faf0ce7f2dbba67d6a796f4862d1b03b74f264f54f1b1bf5e350ef2973f66e3c553eb0d629f36c1aa88517c
data/README.md CHANGED
@@ -16,7 +16,7 @@ Currently supported image formats are:
16
16
  * OVA
17
17
 
18
18
  ## How does cloudkeeper work?
19
- cloudkeeper communicates with cloud specific components via [gRPC](http://www.grpc.io/) communication framework to manage individual clouds.
19
+ cloudkeeper communicates with cloud specific components via [gRPC](http://www.grpc.io/) communication framework to manage individual clouds.
20
20
 
21
21
  Currently supported clouds:
22
22
  * [OpenNebula](https://opennebula.org/) - component [cloudkeeper-one](https://github.com/the-cloudkeeper-project/cloudkeeper-one)
@@ -111,6 +111,8 @@ Options:
111
111
  # Possible values: DEBUG, INFO, WARN, ERROR, FATAL, UNKNOWN
112
112
  [--logging-file=LOGGING-FILE] # File to write logs to
113
113
  # Default: /var/log/cloudkeeper/cloudkeeper.log
114
+ --lock-file=LOCK-FILE # File used to ensure only one running instance of cloudkeeper
115
+ # Default: /var/lock/cloudkeeper/cloudkeeper.lock
114
116
  [--debug], [--no-debug] # Runs cloudkeeper in debug mode
115
117
  ```
116
118
 
data/cloudkeeper.gemspec CHANGED
@@ -1,4 +1,5 @@
1
1
  # coding: utf-8
2
+
2
3
  lib = File.expand_path('../lib', __FILE__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
  require 'cloudkeeper/version'
@@ -11,7 +12,7 @@ Gem::Specification.new do |spec|
11
12
 
12
13
  spec.summary = 'Synchronize cloud appliances between AppDB and cloud platforms'
13
14
  spec.description = 'Synchronize cloud appliances between AppDB and cloud platforms'
14
- spec.homepage = 'https://github.com/Misenko/cloudkeeper'
15
+ spec.homepage = 'https://github.com/the-cloudkeeper-project/cloudkeeper'
15
16
  spec.license = 'Apache License, Version 2.0'
16
17
 
17
18
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
@@ -21,8 +22,8 @@ Gem::Specification.new do |spec|
21
22
  spec.add_development_dependency 'bundler', '~> 1.13'
22
23
  spec.add_development_dependency 'rake', '~> 11.2'
23
24
  spec.add_development_dependency 'rspec', '~> 3.5'
24
- spec.add_development_dependency 'rubocop', '~> 0.42'
25
- spec.add_development_dependency 'rubocop-rspec', '~> 1.7'
25
+ spec.add_development_dependency 'rubocop', '~> 0.48'
26
+ spec.add_development_dependency 'rubocop-rspec', '~> 1.15'
26
27
  spec.add_development_dependency 'rspec-collection_matchers', '~> 1.1'
27
28
  spec.add_development_dependency 'simplecov', '~> 0.12'
28
29
  spec.add_development_dependency 'pry', '~> 0.10'
@@ -24,4 +24,5 @@ cloudkeeper:
24
24
  logging:
25
25
  level: ERROR # Logging level
26
26
  file: /var/log/cloudkeeper/cloudkeeper.log # File to write log to. To turn off file logging leave this field empty.
27
+ lock-file: /var/lock/cloudkeeper/cloudkeeper.lock # File used to ensure only one running instance of cloudkeeper
27
28
  debug: false # Debug mode
@@ -0,0 +1,11 @@
1
+ # Cron job running by default every two hours.
2
+ # The lock file can be enabled or disabled via:
3
+ #
4
+ # service cloudkeeper-cron start
5
+ # chkconfig cloudkeeper-cron on
6
+ #
7
+ # Note that the lock file not existing is a success (and
8
+ # over-all success is needed in order to prevent error
9
+ # messages from cron).
10
+
11
+ 30 */2 * * * cloudkeeper [ ! -f /var/lock/cloudkeeper-cron ] || /usr/bin/cloudkeeper
@@ -0,0 +1,63 @@
1
+ #!/bin/sh
2
+
3
+ ### BEGIN INIT INFO
4
+ # Provides: cloudkeeper-cron
5
+ # Required-Start: $remote_fs $syslog
6
+ # Required-Stop: $remote_fs $syslog
7
+ # Default-Start: 2 3 4 5
8
+ # Default-Stop: 0 1 6
9
+ # Short-Description: Enable periodic run of cloudkeeper
10
+ # Description: This shell script enables the automatic use of cloudkeeper
11
+ ### END INIT INFO
12
+
13
+ lockfile="/var/lock/cloudkeeper-cron"
14
+ retval=0
15
+ name=`basename $0`
16
+
17
+ start() {
18
+ touch $lockfile
19
+ echo "Enabling periodic $name"
20
+ retval=0
21
+ }
22
+
23
+ stop() {
24
+ rm -f $lockfile
25
+ echo "Disabling periodic $name"
26
+ retval=0
27
+ }
28
+
29
+ restart() {
30
+ stop
31
+ start
32
+ }
33
+
34
+ case "$1" in
35
+ start)
36
+ start
37
+ ;;
38
+ stop)
39
+ stop
40
+ ;;
41
+ restart|force-reload)
42
+ restart
43
+ ;;
44
+ reload)
45
+ ;;
46
+ condrestart)
47
+ [ -f "$lockfile" ] && restart
48
+ ;;
49
+ status)
50
+ if [ -f "$lockfile" ] ; then
51
+ echo "Periodic $name is enabled"
52
+ retval=0
53
+ else
54
+ echo "Periodic $name is disabled"
55
+ retval=3
56
+ fi
57
+ ;;
58
+ *)
59
+ echo "Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart}"
60
+ retval=1
61
+ esac
62
+
63
+ exit $retval
@@ -12,6 +12,11 @@ module Cloudkeeper
12
12
  default: Cloudkeeper::Settings['logging']['file'],
13
13
  type: :string,
14
14
  desc: 'File to write logs to'
15
+ class_option :'lock-file',
16
+ default: Cloudkeeper::Settings['lock-file'],
17
+ required: true,
18
+ type: :string,
19
+ desc: 'File used to ensure only one running instance of cloudkeeper'
15
20
  class_option :debug,
16
21
  default: Cloudkeeper::Settings['debug'],
17
22
  type: :boolean,
@@ -102,7 +107,11 @@ module Cloudkeeper
102
107
  desc 'sync', 'Runs synchronization process'
103
108
  def sync
104
109
  initialize_sync options
105
- Cloudkeeper::Managers::ApplianceManager.new.synchronize_appliances
110
+ File.open(Cloudkeeper::Settings[:'lock-file'], File::RDWR | File::CREAT, 0o644) do |file|
111
+ lock = file.flock(File::LOCK_EX | File::LOCK_NB)
112
+ Cloudkeeper::Managers::ApplianceManager.new.synchronize_appliances if lock
113
+ abort 'cloudkeeper instance is already running, quitting' unless lock
114
+ end
106
115
  rescue Cloudkeeper::Errors::InvalidConfigurationError => ex
107
116
  abort ex.message
108
117
  end
@@ -130,11 +139,11 @@ module Cloudkeeper
130
139
 
131
140
  def validate_configuration!
132
141
  validate_configuration_group! :authentication,
133
- [:certificate, :key, :'backend-certificate'],
142
+ %i(certificate key backend-certificate),
134
143
  'Authentication configuration missing'
135
144
  validate_configuration_group! :'remote-mode',
136
- [:'nginx-binary', :'nginx-error-log-file', :'nginx-access-log-file', :'nginx-pid-file',
137
- :'nginx-ip-address', :'nginx-min-port', :'nginx-max-port'],
145
+ %i(nginx-binary nginx-error-log-file nginx-access-log-file nginx-pid-file
146
+ nginx-ip-address nginx-min-port nginx-max-port),
138
147
  'NGINX configuration missing'
139
148
  end
140
149
 
@@ -4,7 +4,7 @@ module Cloudkeeper
4
4
  attr_accessor :identifier, :description, :mpuri, :title, :group, :ram, :core, :version, :architecture
5
5
  attr_accessor :operating_system, :image, :attributes, :vo, :expiration_date, :image_list_identifier
6
6
 
7
- REJECTED_ATTRIBUTES = [:vo, :expiration, :image_list_identifier].freeze
7
+ REJECTED_ATTRIBUTES = %i(vo expiration image_list_identifier).freeze
8
8
 
9
9
  def initialize(identifier, mpuri, vo, expiration_date, image_list_identifier, title = '', description = '', group = '',
10
10
  ram = 1024, core = 1, version = '', architecture = '', operating_system = '', image = nil, attributes = {})
@@ -4,7 +4,7 @@ module Cloudkeeper
4
4
  module Entities
5
5
  module Convertables
6
6
  module Convertable
7
- CONVERT_OUTPUT_FORMATS = [:raw, :qcow2, :vmdk].freeze
7
+ CONVERT_OUTPUT_FORMATS = %i(raw qcow2 vmdk).freeze
8
8
 
9
9
  def self.convert_output_formats
10
10
  CONVERT_OUTPUT_FORMATS
@@ -2,7 +2,7 @@ module Cloudkeeper
2
2
  module Entities
3
3
  module Convertables
4
4
  module Ova
5
- CONVERT_OUTPUT_FORMATS = [:raw, :qcow2].freeze
5
+ CONVERT_OUTPUT_FORMATS = %i(raw qcow2).freeze
6
6
 
7
7
  def self.convert_output_formats
8
8
  CONVERT_OUTPUT_FORMATS
@@ -68,8 +68,8 @@ module Cloudkeeper
68
68
  open(filename, 'w') { |file| response.read_body { |chunk| file.write(chunk) } }
69
69
  end
70
70
  end
71
- rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, Errno::ECONNREFUSED, EOFError, Net::HTTPBadResponse,
72
- Net::HTTPServerException, Net::HTTPHeaderSyntaxError, Net::ProtocolError => ex
71
+ rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, Errno::ECONNREFUSED, Net::HTTPBadResponse,
72
+ Net::HTTPHeaderSyntaxError, EOFError, Net::HTTPServerException => ex
73
73
  raise Cloudkeeper::Errors::NetworkConnectionError, ex
74
74
  end
75
75
 
@@ -1,3 +1,3 @@
1
1
  module Cloudkeeper
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '1.1.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudkeeper
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michal Kimle
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-24 00:00:00.000000000 Z
11
+ date: 2017-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -58,28 +58,28 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0.42'
61
+ version: '0.48'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0.42'
68
+ version: '0.48'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rubocop-rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '1.7'
75
+ version: '1.15'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '1.7'
82
+ version: '1.15'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rspec-collection_matchers
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -325,6 +325,8 @@ files:
325
325
  - bin/cloudkeeper
326
326
  - cloudkeeper.gemspec
327
327
  - config/cloudkeeper.yml
328
+ - examples/etc/cron.d/cloudkeeper
329
+ - examples/etc/init.d/cloudkeeper-cron
328
330
  - lib/cloudkeeper.rb
329
331
  - lib/cloudkeeper/backend_connector.rb
330
332
  - lib/cloudkeeper/cli.rb
@@ -389,7 +391,7 @@ files:
389
391
  - lib/cloudkeeper/utils/url.rb
390
392
  - lib/cloudkeeper/version.rb
391
393
  - lib/cloudkeeper_grpc.rb
392
- homepage: https://github.com/Misenko/cloudkeeper
394
+ homepage: https://github.com/the-cloudkeeper-project/cloudkeeper
393
395
  licenses:
394
396
  - Apache License, Version 2.0
395
397
  metadata: {}