Remove broken CLI operation 'deploy':
* update README; * remove unused code.
This commit is contained in:
parent
fb26f19c99
commit
89e0e78616
11
README.md
11
README.md
|
@ -37,13 +37,13 @@ deploy_engine = Astute::DeploymentEngine::NailyFact
|
|||
orchestrator = Astute::Orchestrator.new(deploy_engine, log_parsing=false)
|
||||
|
||||
# Add systems to cobbler, reboot and start installation process.
|
||||
orchestrator.fast_provision(reporter, environment['engine'], environment['nodes'])
|
||||
orchestrator.provision(reporter, environment['engine'], environment['nodes'])
|
||||
|
||||
# Observation OS installation
|
||||
orchestrator.provision(reporter, environment['task_uuid'], environment['nodes'])
|
||||
orchestrator.watch_provision_progress(reporter, environment['task_uuid'], environment['nodes'])
|
||||
|
||||
# Deploy OpenStack
|
||||
orchestrator.deploy(reporter, environment['task_uuid'], environment['nodes'], environment['attributes'])
|
||||
orchestrator.deploy(reporter, environment['task_uuid'], environment['nodes'])
|
||||
|
||||
```
|
||||
|
||||
|
@ -53,17 +53,12 @@ http://docs.mirantis.com/fuel/3.1/installation-fuel-cli.html#yaml-high-level-str
|
|||
Simple example of using Astute as library: https://github.com/Mirantis/astute/blob/master/bin/astute
|
||||
|
||||
|
||||
|
||||
Using as CLI
|
||||
-----
|
||||
|
||||
Provision:
|
||||
|
||||
astute -f simple.yaml -c provision
|
||||
|
||||
Deploy:
|
||||
|
||||
astute -f simple.yaml -c deploy
|
||||
|
||||
More information about content of `simple.yaml` you can find here: http://docs.mirantis.com/fuel/3.1/installation-fuel-cli.html#yaml-high-level-structure
|
||||
|
||||
|
|
31
bin/astute
31
bin/astute
|
@ -60,12 +60,12 @@ optparse = OptionParser.new do |o|
|
|||
|
||||
o.on_tail("--version", "Show version") { puts Astute::VERSION; exit }
|
||||
|
||||
o.on("-c", "--command COMMAND", [:provision, :deploy, :provision_and_deploy],
|
||||
"Select operation: provision, deploy or provision_and_deploy") do |c|
|
||||
o.on("-c", "--command COMMAND", [:provision],
|
||||
"Select operation: provision") do |c|
|
||||
opts[:command] = c
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
optparse.parse!(ARGV)
|
||||
|
||||
if opts[:filename].nil?
|
||||
|
@ -83,8 +83,6 @@ rescue Errno::ENOENT, Psych::SyntaxError, Astute::Cli::Enviroment::ValidationErr
|
|||
report_and_exit(e, opts[:verbose])
|
||||
end
|
||||
|
||||
deploy_engine = nil
|
||||
|
||||
if environment['attributes'] && environment['attributes']['deployment_engine']
|
||||
case environment['attributes']['deployment_engine']
|
||||
when 'nailyfact'
|
||||
|
@ -92,9 +90,8 @@ if environment['attributes'] && environment['attributes']['deployment_engine']
|
|||
end
|
||||
end
|
||||
|
||||
if [:deploy, :provision, :provision_and_deploy].include? opts[:command]
|
||||
orchestrator = Astute::Orchestrator.new(deploy_engine, log_parsing=true)
|
||||
end
|
||||
deploy_engine ||= nil
|
||||
orchestrator = Astute::Orchestrator.new(deploy_engine, log_parsing=true)
|
||||
|
||||
def console_provision(orchestrator, reporter, environment)
|
||||
orchestrator.provision(reporter, environment['engine'], environment['nodes'])
|
||||
|
@ -104,22 +101,8 @@ def console_provision(orchestrator, reporter, environment)
|
|||
orchestrator.watch_provision_progress(reporter, environment['task_uuid'], environment['nodes'])
|
||||
end
|
||||
|
||||
result = Astute::SUCCESS
|
||||
|
||||
begin
|
||||
result = case opts[:command]
|
||||
when :deploy
|
||||
analize_deploy orchestrator.deploy(reporter, environment['task_uuid'], environment['nodes'], environment['attributes'])
|
||||
when :provision
|
||||
console_provision(orchestrator, reporter, environment)
|
||||
when :provision_and_deploy
|
||||
res = console_provision(orchestrator, reporter, environment)
|
||||
if res == Astute::SUCCESS
|
||||
res = analize_deploy orchestrator.deploy(reporter, environment['task_uuid'], environment['nodes'], environment['attributes'])
|
||||
end
|
||||
res
|
||||
end
|
||||
exit console_provision(orchestrator, reporter, environment) if opts[:command] == :provision
|
||||
rescue => e
|
||||
report_and_exit(e, opts[:verbose])
|
||||
end
|
||||
exit result
|
||||
end
|
|
@ -1,361 +0,0 @@
|
|||
type: map
|
||||
mapping:
|
||||
"task_uuid":
|
||||
type: text
|
||||
"nodes":
|
||||
type: seq
|
||||
required: true
|
||||
desc: Array of nodes
|
||||
name: Nodes
|
||||
sequence:
|
||||
- type: map
|
||||
mapping:
|
||||
"id":
|
||||
type: int
|
||||
unique: yes
|
||||
"uid":
|
||||
type: int
|
||||
unique: yes
|
||||
"fqdn":
|
||||
type: text
|
||||
desc: Fully-qualified domain name of the node
|
||||
"default_gateway":
|
||||
type: text
|
||||
desc: Default gateway for network_data
|
||||
"roles":
|
||||
type: seq
|
||||
required: true
|
||||
desc: Array of roles
|
||||
sequence:
|
||||
- type: text
|
||||
required: true
|
||||
enum: ["primary-controller", "controller", "storage", "swift-proxy", "primary-swift-proxy", "compute", "quantum"]
|
||||
"status":
|
||||
type: text
|
||||
enum: ["ready", "provisioned", "provisioning", "discover"]
|
||||
# Quantum true
|
||||
"public_br":
|
||||
type: text
|
||||
desc: Name of the public bridge for Quantum-enabled configuration
|
||||
# Quantum true
|
||||
"internal_br":
|
||||
type: text
|
||||
desc: Name of the internal bridge for Quantum-enabled configuration
|
||||
"interfaces":
|
||||
type: seq
|
||||
required: true
|
||||
sequence:
|
||||
- type: map
|
||||
mapping:
|
||||
"name":
|
||||
type: text
|
||||
required: true
|
||||
unique: yes
|
||||
"ip_address":
|
||||
type: text
|
||||
unique: yes
|
||||
"netmask":
|
||||
type: text
|
||||
"dns_name":
|
||||
type: text
|
||||
unique: yes
|
||||
"static":
|
||||
type: int
|
||||
range: { min: 0, max: 1 }
|
||||
"mac_address":
|
||||
type: text
|
||||
required: true
|
||||
unique: yes
|
||||
"onboot":
|
||||
type: text
|
||||
required: true
|
||||
enum: ['yes', 'no']
|
||||
"peerdns":
|
||||
type: text
|
||||
required: true
|
||||
enum: ['yes', 'no']
|
||||
"use_for_provision":
|
||||
type: bool
|
||||
default: false
|
||||
name: use_for_provision
|
||||
"network_name":
|
||||
type: seq
|
||||
desc: Array of OpenStack network names
|
||||
sequence:
|
||||
- type: text
|
||||
enum: ["public", "management", "storage", "fixed"]
|
||||
# Full config block
|
||||
"network_data":
|
||||
type: seq
|
||||
desc: Array of network interfaces hashes
|
||||
sequence:
|
||||
- type: map
|
||||
mapping:
|
||||
"name":
|
||||
type: any
|
||||
#unique: true
|
||||
#enum: ['management', 'public', 'storage', 'fixed']
|
||||
desc: Network type
|
||||
"dev":
|
||||
type: text
|
||||
"ip":
|
||||
type: text
|
||||
"netmask":
|
||||
type: text
|
||||
"gateway":
|
||||
type: text
|
||||
|
||||
"attributes":
|
||||
type: map
|
||||
required: true
|
||||
name: Attributes
|
||||
desc: General parameters for deployment
|
||||
mapping:
|
||||
"deployment_id":
|
||||
type: int
|
||||
desc: Id of deployment used do differentiate environments
|
||||
"deployment_source":
|
||||
type: text
|
||||
enum: ['cli', 'web']
|
||||
required: true
|
||||
"management_vip":
|
||||
type: text
|
||||
required: true
|
||||
desc: "Virtual IP address for internal services (MySQL, AMQP, internal OpenStack endpoints)"
|
||||
"public_vip":
|
||||
type: text
|
||||
required: true
|
||||
desc: "Virtual IP address for public services: Horizon, public OpenStack endpoints"
|
||||
"master_ip":
|
||||
type: text
|
||||
required: true
|
||||
desc: IP of puppet master
|
||||
"deployment_mode":
|
||||
type: text
|
||||
enum: ['ha', 'ha_full', 'multinode']
|
||||
desc:
|
||||
required: true
|
||||
"access":
|
||||
type: map
|
||||
required: true
|
||||
mapping:
|
||||
"password":
|
||||
type: text
|
||||
required: true
|
||||
"user":
|
||||
type: text
|
||||
required: true
|
||||
"tenant":
|
||||
type: text
|
||||
required: true
|
||||
"email":
|
||||
type: text
|
||||
required: true
|
||||
"use_cow_images":
|
||||
type: bool
|
||||
required: true
|
||||
desc: Whether to use cow images
|
||||
"auto_assign_floating_ip":
|
||||
type: bool
|
||||
required: true
|
||||
desc: Whether to assign floating IPs automatically
|
||||
"libvirt_type":
|
||||
type: text
|
||||
enum: [qemu, kvm]
|
||||
required: true
|
||||
desc: "Nova libvirt hypervisor type. Values: qemu|kvm"
|
||||
"start_guests_on_host_boot":
|
||||
type: bool
|
||||
required: true
|
||||
"create_networks":
|
||||
type: bool
|
||||
required: true
|
||||
desc: Whether to create fixed or floating networks
|
||||
"quantum":
|
||||
type: bool
|
||||
required: true
|
||||
# Quantum true
|
||||
"quantum_parameters":
|
||||
type: map
|
||||
mapping:
|
||||
"tenant_network_type":
|
||||
type: text
|
||||
enum: ['gre', 'vlan']
|
||||
required: true
|
||||
desc: "Which type of network segmentation to use. Values: gre|vlan"
|
||||
"segment_range":
|
||||
type: text
|
||||
required: true
|
||||
desc: "Range of IDs for network segmentation. Consult Quantum documentation."
|
||||
"metadata_proxy_shared_secret":
|
||||
type: text
|
||||
required: true
|
||||
desc: Shared secret for metadata proxy services
|
||||
"mysql":
|
||||
type: map
|
||||
required: true
|
||||
desc: Credentials for MySQL
|
||||
mapping:
|
||||
"root_password":
|
||||
type: text
|
||||
required: true
|
||||
"swift":
|
||||
type: map
|
||||
required: true
|
||||
desc: Credentials for Swift
|
||||
mapping:
|
||||
"user_password":
|
||||
type: text
|
||||
required: true
|
||||
"glance":
|
||||
type: map
|
||||
required: true
|
||||
desc: Credentials for Glance
|
||||
mapping:
|
||||
"user_password":
|
||||
type: text
|
||||
required: true
|
||||
"db_password":
|
||||
type: text
|
||||
required: true
|
||||
"nova":
|
||||
type: map
|
||||
required: true
|
||||
desc: Credentials for Nova
|
||||
mapping:
|
||||
"user_password":
|
||||
type: text
|
||||
required: true
|
||||
"db_password":
|
||||
type: text
|
||||
required: true
|
||||
"keystone":
|
||||
type: map
|
||||
required: true
|
||||
desc: Credentials for Keystone
|
||||
mapping:
|
||||
"db_password":
|
||||
type: text
|
||||
required: true
|
||||
"admin_token":
|
||||
type: text
|
||||
required: true
|
||||
# Quantum true
|
||||
"quantum_access":
|
||||
type: map
|
||||
desc: Credentials for Quantum Access
|
||||
mapping:
|
||||
"user_password":
|
||||
type: text
|
||||
required: true
|
||||
"db_password":
|
||||
type: text
|
||||
required: true
|
||||
"rabbit":
|
||||
type: map
|
||||
required: true
|
||||
desc: Credentials for RabbitMQ
|
||||
mapping:
|
||||
"user":
|
||||
type: text
|
||||
required: true
|
||||
"password":
|
||||
type: text
|
||||
required: true
|
||||
"cinder":
|
||||
type: map
|
||||
required: true
|
||||
desc: Credentials for Cinder
|
||||
mapping:
|
||||
"user":
|
||||
type: text
|
||||
required: true
|
||||
"password":
|
||||
type: text
|
||||
required: true
|
||||
# CIDR (for quantum == true) or array if IPs (for quantum == false)
|
||||
"floating_network_range":
|
||||
type: any
|
||||
required: true
|
||||
desc: |
|
||||
Used for creation of floating networks/IPs during deployment.
|
||||
CIDR (for quantum == true) or array if IPs (for quantum == false)
|
||||
"fixed_network_range":
|
||||
type: text
|
||||
required: true
|
||||
desc: CIDR for fixed network created during deployment
|
||||
"ntp_servers":
|
||||
type: seq
|
||||
required: true
|
||||
desc: Array of ntp servers
|
||||
sequence:
|
||||
- type: "text"
|
||||
required: true
|
||||
"dns_nameservers":
|
||||
type: seq
|
||||
required: true
|
||||
desc: Array of DNS servers configured during deployment phase
|
||||
sequence:
|
||||
- type: "text"
|
||||
required: true
|
||||
"cinder_nodes":
|
||||
type: seq
|
||||
desc: |
|
||||
Array of nodes to use as cinder-volume backends. Values: 'all'|<hostname>|
|
||||
<internal IP address of node>|'controller'|<node_role>"
|
||||
sequence:
|
||||
- type: "text"
|
||||
required: true
|
||||
"base_syslog":
|
||||
type: map
|
||||
required: true
|
||||
desc: Main syslog server configuration
|
||||
mapping:
|
||||
"syslog_server":
|
||||
type: text
|
||||
required: true
|
||||
"syslog_port":
|
||||
type: text
|
||||
required: true
|
||||
"syslog":
|
||||
type: map
|
||||
required: true
|
||||
desc: Additional syslog servers configuration
|
||||
mapping:
|
||||
"syslog_port":
|
||||
type: text
|
||||
"syslog_transport":
|
||||
type: text
|
||||
enum: ['tcp', 'udp']
|
||||
"syslog_server":
|
||||
type: text
|
||||
"horizon_use_ssl":
|
||||
type: text
|
||||
enum: ['false', 'default', 'exist', 'custom']
|
||||
desc: Use HTTP or HTTPS for OpenStack dashboard (Horizon)
|
||||
"compute_scheduler_driver":
|
||||
type: text
|
||||
enum: ['nova.scheduler.multi.MultiScheduler', 'nova.scheduler.filter_scheduler.FilterScheduler']
|
||||
desc: Nova scheduler driver class
|
||||
"use_unicast_corosync":
|
||||
type: bool
|
||||
default: false
|
||||
desc: |
|
||||
Fuel uses Corosync and Pacemaker cluster engines for HA scenarios, thus
|
||||
requiring consistent multicast networking. Sometimes it is not possible to configure
|
||||
multicast in your network. In this case, you can tweak Corosync to use unicast addressing
|
||||
by setting use_unicast_corosync variable to true.
|
||||
"auth_key":
|
||||
type: text
|
||||
"network_manager":
|
||||
type: text
|
||||
"verbose":
|
||||
type: bool
|
||||
desc: How much information OpenStack provides when performing configuration (verbose mode)
|
||||
"debug":
|
||||
type: bool
|
||||
desc: How much information OpenStack provides when performing configuration (debug mode)
|
||||
"deployment_id":
|
||||
type: int
|
||||
required: true
|
||||
desc: Deployment ID(for CI just set 1)
|
|
@ -31,8 +31,7 @@ module Astute
|
|||
'mco_auto_setup', 'auth_key', 'puppet_version', 'mco_connector', 'mco_host']
|
||||
NETWORK_KEYS = ['ip', 'mac', 'fqdn']
|
||||
PROVISIONING_NET_KEYS = ['power_address']
|
||||
PROVISION_OPERATIONS = [:provision, :provision_and_deploy]
|
||||
DEPLOY_OPERATIONS = [:deploy, :provision_and_deploy]
|
||||
PROVISION_OPERATIONS = [:provision]
|
||||
|
||||
CIDR_REGEXP = '^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|
|
||||
2[0-4][0-9]|25[0-5])(\/(\d|[1-2]\d|3[0-2]))$'
|
||||
|
@ -53,12 +52,12 @@ module Astute
|
|||
@config['nodes'].each do |node|
|
||||
|
||||
# Common section
|
||||
node['meta'] ||= {}
|
||||
define_network_ids(node)
|
||||
define_id_and_uid(node)
|
||||
|
||||
# Provision section
|
||||
if PROVISION_OPERATIONS.include? operation
|
||||
node['meta'] ||= {}
|
||||
define_network_ids(node)
|
||||
define_power_address(node)
|
||||
define_interfaces_and_interfaces_extra(node)
|
||||
define_ks_spaces(node)
|
||||
|
@ -67,13 +66,6 @@ module Astute
|
|||
define_node_settings(node)
|
||||
define_disks_section(node)
|
||||
end
|
||||
|
||||
# Deploy section
|
||||
if DEPLOY_OPERATIONS.include? operation
|
||||
define_meta_interfaces(node)
|
||||
define_fqdn(node)
|
||||
define_network_data(node)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -93,47 +85,6 @@ module Astute
|
|||
if errors.select {|e| !e.message.include?("is undefined") }.size > 0
|
||||
raise Enviroment::ValidationError, "Environment validation failed"
|
||||
end
|
||||
|
||||
if DEPLOY_OPERATIONS.include?(operation)
|
||||
if @config['attributes']['quantum']
|
||||
@config['nodes'].each do |node|
|
||||
['public_br', 'internal_br'].each do |br|
|
||||
if node[br].nil? || node[br].empty?
|
||||
raise Enviroment::ValidationError, "Node #{node['name'] || node['hostname']}
|
||||
required 'public_br' and 'internal_br' when quantum is 'true'"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
errors = []
|
||||
['quantum_parameters', 'quantum_access'].each do |param|
|
||||
errors << param unless @config['attributes'][param].present?
|
||||
end
|
||||
errors.each do |field|
|
||||
msg = "#{field} is required when quantim is true"
|
||||
raise Enviroment::ValidationError, msg
|
||||
end
|
||||
|
||||
if !is_cidr_notation?(@config['attributes']['floating_network_range'])
|
||||
msg = "'floating_network_range' is required CIDR notation when quantum is 'true'"
|
||||
raise Enviroment::ValidationError, msg
|
||||
end
|
||||
|
||||
if !is_cidr_notation?(@config['attributes']['floating_network_range'])
|
||||
msg = "'floating_network_range' is required CIDR notation"
|
||||
raise Enviroment::ValidationError, msg
|
||||
end
|
||||
else
|
||||
if @config['attributes']['floating_network_range'].is_a?(Array)
|
||||
msg = "'floating_network_range' is required array of IPs when quantum is 'false'"
|
||||
raise Enviroment::ValidationError, msg
|
||||
end
|
||||
end
|
||||
if !is_cidr_notation?(@config['attributes']['fixed_network_range'])
|
||||
msg = "'fixed_network_range' is required CIDR notation"
|
||||
raise Enviroment::ValidationError, msg
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Get data about discovered nodes using FuelWeb API
|
||||
|
|
|
@ -19,13 +19,7 @@ module Astute
|
|||
class YamlValidator < Kwalify::Validator
|
||||
|
||||
def initialize(operation)
|
||||
schemas = if [:deploy, :provision].include? operation
|
||||
[operation]
|
||||
elsif operation == :provision_and_deploy
|
||||
[:provision, :deploy]
|
||||
else
|
||||
raise "Incorrect scheme for validation"
|
||||
end
|
||||
[:provision].include?(operation) ? schemas = [operation] : raise("Incorrect scheme for validation")
|
||||
|
||||
schema_hashes = []
|
||||
schema_dir_path = File.expand_path(File.dirname(__FILE__))
|
||||
|
|
Loading…
Reference in New Issue