Class: Cloudkeeper::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/cloudkeeper/cli.rb

Instance Method Summary collapse

Instance Method Details

#syncObject



128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/cloudkeeper/cli.rb', line 128

def sync
  initialize_sync options
  File.open(Cloudkeeper::Settings[:'lock-file'], File::RDWR | File::CREAT, 0o644) do |file|
    lock = file.flock(File::LOCK_EX | File::LOCK_NB)
    Cloudkeeper::Managers::ApplianceManager.new.synchronize_appliances if lock
    abort 'cloudkeeper instance is already running, quitting' unless lock
  end
rescue Cloudkeeper::Errors::InvalidConfigurationError => ex
  abort ex.message
rescue StandardError => ex
  logger.error "Unexpected error: #{ex.message}"
  raise ex
end

#versionObject



143
144
145
# File 'lib/cloudkeeper/cli.rb', line 143

def version
  $stdout.puts Cloudkeeper::VERSION
end