Skip to content

Commit

Permalink
Merge branch 'master' into nuage-logger
Browse files Browse the repository at this point in the history
  • Loading branch information
miha-plesko authored Dec 13, 2017
2 parents 7c38237 + 5b2e1b8 commit ce81310
Show file tree
Hide file tree
Showing 48 changed files with 562 additions and 185 deletions.
1 change: 1 addition & 0 deletions .rubocop_local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ GlobalVars:
- $scvmm_log
- $vim_log
- $websocket_log
- $vcloud_log
- $nuage_log
# In Automate methods
- $evm
Expand Down
53 changes: 53 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,59 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)


## Unreleased as of Sprint 74 ending 2017-11-27

### Added
- Alerts
- Alert seeding: allowing fixtures to have its own notification options [(#16485)](https://github.com/ManageIQ/manageiq/pull/16485)
- Seed MiqAlerts used for Prometheus Alerts [(#16479)](https://github.com/ManageIQ/manageiq/pull/16479)
- Add miq_expression setter to MiqAlert [(#16397)](https://github.com/ManageIQ/manageiq/pull/16397)
- Automate
- Adds field unique validator check to dialog [(#16487)](https://github.com/ManageIQ/manageiq/pull/16487)
- Add #raw_stdout_via_worker method [(#16441)](https://github.com/ManageIQ/manageiq/pull/16441)
- Core
- Remove the column reordering tool and the schema structure validations [(#16488)](https://github.com/ManageIQ/manageiq/pull/16488)
- Added User Agent to VMDB::Appliance [(#16410)](https://github.com/ManageIQ/manageiq/pull/16410)
- Added Product name to VMDB::Appliance [(#16409)](https://github.com/ManageIQ/manageiq/pull/16409)
- Providers
- Update ems_infra_admin_ui feature to role assignment [(#16484)](https://github.com/ManageIQ/manageiq/pull/16484)
- Add ems_infra_admin_ui feature [(#16403)](https://github.com/ManageIQ/manageiq/pull/16403)

### Fixes
- API
- Fixes a stack trace issue (500) during API authentication. [(#16520)](https://github.com/ManageIQ/manageiq/pull/16520)
- Automate
- Imports old associations [(#16471)](https://github.com/ManageIQ/manageiq/pull/16471)
- Chargeback
- Fix nil cases of allocated disk types in chargeback reporting [(#16434)](https://github.com/ManageIQ/manageiq/pull/16434)
- Core
- Move the notifications to include more of the setup [(#16508)](https://github.com/ManageIQ/manageiq/pull/16508)
- Add a connection to the pool if there is only one for embedded ansible [(#16477)](https://github.com/ManageIQ/manageiq/pull/16477)
- Workers can run log_status so ask for the right pid [(#16460)](https://github.com/ManageIQ/manageiq/pull/16460)
- Finish simplifying NTP configuration using Settings [(#16393)](https://github.com/ManageIQ/manageiq/pull/16393)
- Fix Expression builder argument error by reverting #5506 [(#16255)](https://github.com/ManageIQ/manageiq/pull/16255)
- Events
- Fix typo in policy event details header [(#16513)](https://github.com/ManageIQ/manageiq/pull/16513)
- i18n
- Fix string interpolations [(#16468)](https://github.com/ManageIQ/manageiq/pull/16468)
- Providers
- Make sure we do not pass primary_key to insert query [(#16503)](https://github.com/ManageIQ/manageiq/pull/16503)
- Require miq_fault_tolerant_vim in raw_connect [(#16500)](https://github.com/ManageIQ/manageiq/pull/16500)
- Add Middleware Server EAP/Wildfly translation [(#16492)](https://github.com/ManageIQ/manageiq/pull/16492)
- Remove fault_tolerant from vim_connect [(#16472)](https://github.com/ManageIQ/manageiq/pull/16472)
- Added a Maintenance key to the hash struct [(#16464)](https://github.com/ManageIQ/manageiq/pull/16464)
- Require handsoap in VimConnectMixin [(#16450)](https://github.com/ManageIQ/manageiq/pull/16450)
- Move graph refresh internals logging to debug [(#16442)](https://github.com/ManageIQ/manageiq/pull/16442)
- Refresh new target do not run post_refresh [(#16436)](https://github.com/ManageIQ/manageiq/pull/16436)
- Unique EmsRefresh.refresh targets if there are over 1000 targets [(#16432)](https://github.com/ManageIQ/manageiq/pull/16432)
- Container ssa annotate success [(#15031)](https://github.com/ManageIQ/manageiq/pull/15031)
- Replication
- Scope Tenant#name validation to the current region [(#16506)](https://github.com/ManageIQ/manageiq/pull/16506)
- Reporting
- Fixed syntax with `orderby` in RSS Feed YAML files [(#16493)](https://github.com/ManageIQ/manageiq/pull/16493)
- UI
- Standalone ServiceUI product features require updating affected roles [(#16329)](https://github.com/ManageIQ/manageiq/pull/16329)

## Unreleased as of Sprint 73 ending 2017-11-13

### Added
Expand Down
6 changes: 6 additions & 0 deletions app/models/chargeback_rate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ class ChargebackRate < ApplicationRecord
scope :with_rate_type, ->(rate_type) { where(:rate_type => rate_type) }

VALID_CB_RATE_TYPES = ["Compute", "Storage"]
DATASTORE_MAPPING = {'CloudVolume' => 'Storage'}.freeze

def self.tag_class(klass)
klass = ChargebackRate::DATASTORE_MAPPING[klass] || klass
super(klass)
end

def rate_details_relevant_to(report_cols)
# we can memoize, as we get the same report_cols thrrough the life of the object
Expand Down
8 changes: 4 additions & 4 deletions app/models/dialog/orchestration_template_service_dialog.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
class Dialog
class OrchestrationTemplateServiceDialog
def self.create_dialog(label, template)
new.create_dialog(label, template)
def self.create_dialog(name, template)
new.create_dialog(name, template)
end

def create_dialog(label, template)
Dialog.new(:label => label, :buttons => "submit,cancel").tap do |dialog|
def create_dialog(name, template)
Dialog.new(:name => name, :buttons => "submit,cancel").tap do |dialog|
tab = dialog.dialog_tabs.build(:display => "edit", :label => "Basic Information", :position => 0)
add_stack_group(template.deployment_options, tab, 0)

Expand Down
4 changes: 2 additions & 2 deletions app/models/ems_refresh/link_inventory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ def link_ems_inventory(ems, target, prev_relats, new_relats, disconnect = true)
_log.info("#{log_header} Updating EMS root folder relationship.")
root_id = new_relats[:ext_management_systems_to_folders][ems.id][0]
if root_id.nil?
ems.remove_all_children
ems.remove_all_children if disconnect
else
ems.replace_children(instance_with_id(EmsFolder, root_id))
ems.replace_children(instance_with_id(EmsFolder, root_id)) if disconnect
end

# Do the Folders to *, and Clusters to * relationships
Expand Down
2 changes: 1 addition & 1 deletion app/models/ems_refresh/save_inventory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ def save_networks_inventory(hardware, hashes, mode = :refresh)
saved_hashes, new_hashes = hashes.partition { |h| h[:id] }
saved_hashes.each { |h| deletes.delete_if { |d| d.id == h[:id] } } unless deletes.empty? || saved_hashes.empty?

save_inventory_multi(hardware.networks, new_hashes, deletes, [:ipaddress], nil, :guest_device)
save_inventory_multi(hardware.networks, new_hashes, deletes, [:ipaddress, :ipv6address], nil, :guest_device)
when :scan
save_inventory_multi(hardware.networks, hashes, :use_association, [:description, :guid])
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/ext_management_system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def self.supported_types_and_descriptions_hash
has_many :policy_events, -> { order("timestamp") }, :class_name => "PolicyEvent", :foreign_key => "ems_id"

has_many :blacklisted_events, :foreign_key => "ems_id", :dependent => :destroy, :inverse_of => :ext_management_system
has_many :miq_alert_statuses, :foreign_key => "ems_id"
has_many :miq_alert_statuses, :foreign_key => "ems_id", :dependent => :destroy
has_many :ems_folders, :foreign_key => "ems_id", :dependent => :destroy, :inverse_of => :ext_management_system
has_many :ems_clusters, :foreign_key => "ems_id", :dependent => :destroy, :inverse_of => :ext_management_system
has_many :resource_pools, :foreign_key => "ems_id", :dependent => :destroy, :inverse_of => :ext_management_system
Expand Down
2 changes: 1 addition & 1 deletion app/models/job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def timeout!
end

def target_entity
target_class.constantize.find_by(:id => target_id)
target_class.constantize.find_by(:id => target_id) if target_class
end

def self.check_jobs_for_timeout
Expand Down
4 changes: 4 additions & 0 deletions app/models/manageiq/providers/base_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ def ext_management_system
self
end

def supported_catalog_types
[]
end

def refresher
self.class::Refresher
end
Expand Down
4 changes: 4 additions & 0 deletions app/models/manageiq/providers/embedded_automation_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,8 @@ class ManageIQ::Providers::EmbeddedAutomationManager < ManageIQ::Providers::Auto
require_nested :ConfigurationScriptSource
require_nested :ConfiguredSystem
require_nested :OrchestrationStack

def supported_catalog_types
%w(generic_ansible_playbook)
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class << self
def networks(extra_attributes = {})
attributes = {
:model_class => ::Network,
:manager_ref => [:hardware, :ipaddress],
:manager_ref => [:hardware, :ipaddress, :ipv6address],
:association => :networks,
}

Expand Down
5 changes: 2 additions & 3 deletions app/models/metric/chargeback_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ def tag_list_with_prefix
def resource_parents
[parent_host || resource.try(:host),
parent_ems_cluster || resource.try(:ems_cluster),
parent_storage || resource.try(:storage),
parent_storage || resource.try(:storage) || resource.try(:cloud_volumes),
parent_ems || resource.try(:ext_management_system),
resource.try(:tenant)
].compact
resource.try(:tenant)].flatten.compact
end

def parents_determining_rate
Expand Down
2 changes: 2 additions & 0 deletions app/models/middleware_datasource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ class MiddlewareDatasource < ApplicationRecord
acts_as_miq_taggable
serialize :properties

delegate :mutable?, :in_domain?, :to => :middleware_server

def metrics_capture
@metrics_capture ||= ManageIQ::Providers::Hawkular::MiddlewareManager::LiveMetricsCapture.new(self)
end
Expand Down
8 changes: 7 additions & 1 deletion app/models/miq_alert_set.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class MiqAlertSet < ApplicationRecord
acts_as_miq_set

before_validation :default_name_to_guid, :on => :create
before_validation :default_name_to_description, :on => :create

include AssignmentMixin

Expand Down Expand Up @@ -48,4 +48,10 @@ def self.seed
return unless File.exist?(fixture_file)
File.open(fixture_file) { |fd| MiqAlertSet.import_from_yaml(fd, :save => true) }
end

private

def default_name_to_description
self.name ||= description
end
end
4 changes: 0 additions & 4 deletions app/models/miq_filter.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
module MiqFilter
def self.records2table(records, only_columns)
MiqReportable.records2table(records, only_columns)
end

def self.belongsto2object(tag)
belongsto2object_list(tag).last
end
Expand Down
8 changes: 7 additions & 1 deletion app/models/miq_policy_set.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class MiqPolicySet < ApplicationRecord
acts_as_miq_set

before_validation :default_name_to_guid, :on => :create
before_validation :default_name_to_description, :on => :create
before_destroy :destroy_policy_tags

attr_accessor :reserved
Expand Down Expand Up @@ -84,4 +84,10 @@ def self.seed
end
end
end

private

def default_name_to_description
self.name ||= description
end
end # class MiqPolicySet
33 changes: 0 additions & 33 deletions app/models/miq_reportable.rb

This file was deleted.

8 changes: 5 additions & 3 deletions app/models/mixins/assignment_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ def assignments
end
end

def tag_class(klass)
klass == "VmOrTemplate" ? "vm" : klass.underscore
end

# @param target
# @option options :parents
# @option options :tag_list
Expand All @@ -196,9 +200,7 @@ def get_assigned_for_target(target, options = {})
tlist = Tagging.where("tags.name like '/managed/%'")
.where(:taggable => parents)
.references(:tag).includes(:tag).map do |t|
klass = t.taggable_type
lower_klass = klass == "VmOrTemplate" ? "vm" : klass.underscore
"#{lower_klass}/tag#{t.tag.name}"
"#{tag_class(t.taggable_type)}/tag#{t.tag.name}"
end
tagged_resources = tlist.flat_map { |t| assignments_cached[t] }.uniq
(individually_assigned_resources + tagged_resources).uniq
Expand Down
5 changes: 0 additions & 5 deletions app/models/mixins/vim_connect_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ def connect(options = {})
raise _("no credentials defined") if missing_credentials?(options[:auth_type])

options[:use_broker] = (self.class.respond_to?(:use_vim_broker?) ? self.class.use_vim_broker? : ManageIQ::Providers::Vmware::InfraManager.use_vim_broker?) unless options.key?(:use_broker)
if options[:use_broker] && !MiqVimBrokerWorker.available?
msg = "Broker Worker is not available"
_log.error(msg)
raise MiqException::MiqVimBrokerUnavailable, _("Broker Worker is not available")
end
options[:vim_broker_drb_port] ||= MiqVimBrokerWorker.method(:drb_port) if options[:use_broker]

# The following require pulls in both MiqFaultTolerantVim and MiqVim
Expand Down
11 changes: 10 additions & 1 deletion app/models/service_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ServiceTemplate < ApplicationRecord
"generic_orchestration" => _("Orchestration"),
"generic_ansible_playbook" => _("Ansible Playbook"),
"generic_ansible_tower" => _("AnsibleTower"),
"generic_container_template" => _("Container Template"),
"generic_container_template" => _("OpenShift Template"),
"google" => _("Google"),
"microsoft" => _("SCVMM"),
"openstack" => _("OpenStack"),
Expand Down Expand Up @@ -69,6 +69,15 @@ class ServiceTemplate < ApplicationRecord
scope :with_existent_service_template_catalog_id, -> { where.not(:service_template_catalog_id => nil) }
scope :displayed, -> { where(:display => true) }

def self.catalog_item_types
ci_types = Set.new(Rbac.filtered(ExtManagementSystem.all).flat_map(&:supported_catalog_types))
ci_types.add('generic_orchestration') if Rbac.filtered(OrchestrationTemplate).exists?
ci_types.add('generic')
CATALOG_ITEM_TYPES.each.with_object({}) do |(key, description), hash|
hash[key] = { :description => description, :display => ci_types.include?(key) }
end
end

def self.create_catalog_item(options, auth_user)
transaction do
create_from_options(options).tap do |service_template|
Expand Down
1 change: 1 addition & 0 deletions config/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,7 @@
:level_scvmm: info
:level_vim: warn
:level_websocket: info
:level_vcloud: info
:level_nuage: info
:ntp:
:server:
Expand Down
35 changes: 15 additions & 20 deletions db/fixtures/miq_product_features.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6509,28 +6509,23 @@
:identifier: physical_infra_topology_view

# Monitor
- :name: Monitor
:description: Everything under Monitor
- :name: Alerts
:description: Alerts
:feature_type: node
:identifier: monitor
:identifier: monitor_alerts
:children:
- :name: Alerts
:description: Alerts
:feature_type: node
:identifier: monitor_alerts
:children:
- :name: Overview
:description: Alerts Overview
:feature_type: view
:identifier: monitor_alerts_overview
- :name: All Alerts
:description: Show Alerts List
:feature_type: view
:identifier: monitor_alerts_list
- :name: Most Recent Alerts
:description: Show Most Recent Alerts
:feature_type: view
:identifier: monitor_alerts_most_recent
- :name: Overview
:description: Alerts Overview
:feature_type: view
:identifier: monitor_alerts_overview
- :name: All Alerts
:description: Show Alerts List
:feature_type: view
:identifier: monitor_alerts_list
- :name: Most Recent Alerts
:description: Show Most Recent Alerts
:feature_type: view
:identifier: monitor_alerts_most_recent

# API
- :name: API
Expand Down
Loading

0 comments on commit ce81310

Please sign in to comment.