#!/usr/bin/env ruby # (c) Copyright 2014 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # require 'byebug' require 'bundler/setup' require 'lorj_cloud' process_module = 'cloud' PrcLib.log_object = Logger.new(STDOUT) PrcLib.level = Logger::DEBUG PrcLib.core_level = 5 unless Lorj.processes.key?(process_module) PrcLib.fatal(1, "Unable to found the process module '%s'. \n"\ 'Modules loaded:', process_module, Lorj.processes.keys) end if Lorj.processes[process_module].controllers.nil? PrcLib.fatal(1, "no controllers found in module '%s'.\n", process_module) end PrcLib.high_level_msg('Welcome to lorj_cloud - Simple process to build a '\ "cloud box\n"\ 'This simple script uses lorj_cloud process to guide you'\ ' setup and create a server in your cloud.') # say("Please choose your cloud provider:") # provider = choose do |q| # controllers = Lorj.processes[process_module].controllers.keys # q.choices(*controllers) # end provider = 'openstack' processes = [{ :process_module => process_module, :controller_name => provider }] core = Lorj::Core.new(nil, processes) PrcLib.message('You are going to create a server') # server = ask('Enter a server name:') do |q| # q.validate = /\w+/ # end server = 'test' PrcLib.message('Now, we are going to ask you some data about your cloud and '\ 'information to create your server') # byebug core.setup(:server) core.create(:server, :server_name => server)