jellyfish-manageiq 0.0.1 → 0.0.3

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: a27727a0d562774f594b8f2307b18d6b2061afac
4
- data.tar.gz: f1766f62fb667f24811f545bb40759c06a1fe962
3
+ metadata.gz: 66c8563374332f18cba1322b50074d899c58650f
4
+ data.tar.gz: dffb69562be8ecfa8e7afdf37e83e085d7c069ff
5
5
  SHA512:
6
- metadata.gz: ab517e59aff8285eae9a32b53ac6e458a0020bec985fad1bd0d4254d21403652d4084c94908e00b1fd32698eaffe579fce84d092d657000e473f5501832b088e
7
- data.tar.gz: 0eae37eaa4da21bb86c3132c706e4c2b56f2a6e87c146dfba115b7ce1c2599d4f04dc75dd5924fcd90e9aac2bf7346be16a4d63db433cd9d4f9b0cfdf4ef3692
6
+ metadata.gz: 4cf4c9ad3dda772236e3d68a7dcb423bb515dbc76ba73d58c2c6dae7129ef54e0e0a1bc469ed90123d7d1ec83b7df800f06237d28f6127e38ac464f0152cde6e
7
+ data.tar.gz: f070ff0de674d92bff04088f7b353e3b6edc4f71b4439df74c52725cdc5ea581a10c7753d810cfc183b6cf9ed0fca8ff153fcfc46ca6698c33586e66bb7971be
@@ -2,11 +2,11 @@
2
2
 
3
3
  # Learn more: http://github.com/jmettraux/rufus-scheduler
4
4
 
5
- require 'rufus-scheduler'
6
- require 'rake'
7
-
8
- scheduler = Rufus::Scheduler.new
9
-
10
- scheduler.every '15m' do
11
- Rake::Task['jellyfish:manageiq:pollvms']
12
- end
5
+ # require 'rufus-scheduler'
6
+ # require 'rake'
7
+ #
8
+ # scheduler = Rufus::Scheduler.new
9
+ #
10
+ # scheduler.every '15m' do
11
+ # Rake::Task['jellyfish:manageiq:pollvms']
12
+ # end
@@ -4,16 +4,6 @@ module Jellyfish
4
4
  engine_name 'jellyfish_manageiq' # For identification in rake tasks
5
5
 
6
6
  config.autoload_paths += %W(#{config.root}/lib)
7
-
8
- # This lets our migrations run with a simple rake db:migrate from the app
9
- # http://pivotallabs.com/leave-your-migrations-in-your-rails-engines/
10
- initializer :append_migrations do |app|
11
- unless app.root.to_s == root.to_s
12
- config.paths['db/migrate'].expanded.each do |expanded_path|
13
- app.config.paths['db/migrate'] << expanded_path
14
- end
15
- end
16
- end
17
7
  end
18
8
  end
19
9
  end
@@ -1,5 +1,5 @@
1
1
  module Jellyfish
2
2
  module ManageIQ
3
- VERSION = '0.0.1'
3
+ VERSION = '0.0.3'
4
4
  end
5
5
  end
@@ -1,42 +1,42 @@
1
1
  require 'dotenv/tasks'
2
2
 
3
- namespace :jellyfish do
4
- namespace :manageiq do
5
- desc 'Poll ManageIQ VMS'
6
- task pollvms: [:dotenv, :environment] do
7
- # setup metadata
8
- vm_list = ManageIQClient::VirtualMachine.list
9
- miq_path = ManageIQClient.host + ManageIQClient::VirtualMachine.path + '/'
10
-
11
- # get the ids of each resource
12
- resource_ids = []
13
- unless vm_list['resources'].nil?
14
- vm_list['resources'].each do |resource_path|
15
- if resource_path['href'].index(miq_path) == 0
16
- resource_id = resource_path['href'][miq_path.length, resource_path['href'].length].to_i
17
- resource_ids << resource_id
18
- end
19
- end
20
- resource_ids = resource_ids.sort
21
- end
22
-
23
- # poll each vm and create alerts for power off state
24
- resource_ids.each do |resource_id|
25
- vm_info = ManageIQClient::VirtualMachine.find resource_id
26
- message_status = (vm_info[:power_state] == 'on') ? 'OK' : 'WARNING'
27
- message = message_status + ': ' + 'The VM resource with ID ' + resource_id.to_s + " is in the '" + vm_info[:power_state] + "' state."
28
- alert_params = { project_id: '0', staff_id: '0', order_item_id: resource_id, status: message_status, message: message, start_date: Time.zone.now.to_s }
29
- conditions = { project_id: alert_params[:project_id], order_item_id: alert_params[:order_item_id], status: alert_params[:status] }
30
- result = ::Alert.where(conditions).order('updated_at DESC').first
31
- alert_id = (result.nil? || result.id.nil?) ? nil : result.id
32
- if alert_id.nil? # CAN CREATE AS NEW
33
- result = ::Alert.new alert_params
34
- else # UPDATE THE ATTRIBUTE - UPDATE ID
35
- result.update_attributes alert_params
36
- end
37
- result.save
38
- puts message
39
- end
40
- end
41
- end
42
- end
3
+ # namespace :jellyfish do
4
+ # namespace :manageiq do
5
+ # desc 'Poll ManageIQ VMS'
6
+ # task pollvms: [:dotenv, :environment] do
7
+ # # setup metadata
8
+ # vm_list = ManageIQClient::VirtualMachine.list
9
+ # miq_path = ManageIQClient.host + ManageIQClient::VirtualMachine.path + '/'
10
+ #
11
+ # # get the ids of each resource
12
+ # resource_ids = []
13
+ # unless vm_list['resources'].nil?
14
+ # vm_list['resources'].each do |resource_path|
15
+ # if resource_path['href'].index(miq_path) == 0
16
+ # resource_id = resource_path['href'][miq_path.length, resource_path['href'].length].to_i
17
+ # resource_ids << resource_id
18
+ # end
19
+ # end
20
+ # resource_ids = resource_ids.sort
21
+ # end
22
+ #
23
+ # # poll each vm and create alerts for power off state
24
+ # resource_ids.each do |resource_id|
25
+ # vm_info = ManageIQClient::VirtualMachine.find resource_id
26
+ # message_status = (vm_info[:power_state] == 'on') ? 'OK' : 'WARNING'
27
+ # message = message_status + ': ' + 'The VM resource with ID ' + resource_id.to_s + " is in the '" + vm_info[:power_state] + "' state."
28
+ # alert_params = { project_id: '0', staff_id: '0', order_item_id: resource_id, status: message_status, message: message, start_date: Time.zone.now.to_s }
29
+ # conditions = { project_id: alert_params[:project_id], order_item_id: alert_params[:order_item_id], status: alert_params[:status] }
30
+ # result = ::Alert.where(conditions).order('updated_at DESC').first
31
+ # alert_id = (result.nil? || result.id.nil?) ? nil : result.id
32
+ # if alert_id.nil? # CAN CREATE AS NEW
33
+ # result = ::Alert.new alert_params
34
+ # else # UPDATE THE ATTRIBUTE - UPDATE ID
35
+ # result.update_attributes alert_params
36
+ # end
37
+ # result.save
38
+ # puts message
39
+ # end
40
+ # end
41
+ # end
42
+ # end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jellyfish-manageiq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jerimiah Milton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-15 00:00:00.000000000 Z
11
+ date: 2015-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -320,10 +320,6 @@ files:
320
320
  - config/product_questions/storage.json
321
321
  - config/provisioners.json
322
322
  - config/routes.rb
323
- - db/migrate/20150513221625_create_jellyfish_manageiq_database_products.rb
324
- - db/migrate/20150513221938_create_jellyfish_manageiq_big_data_products.rb
325
- - db/migrate/20150513222020_create_jellyfish_manageiq_infrastructure_products.rb
326
- - db/migrate/20150513222056_create_jellyfish_manageiq_storage_products.rb
327
323
  - lib/jellyfish/manageiq.rb
328
324
  - lib/jellyfish/manageiq/big_data.rb
329
325
  - lib/jellyfish/manageiq/databases.rb
@@ -1,16 +0,0 @@
1
- class CreateJellyfishManageiqDatabaseProducts < ActiveRecord::Migration
2
- def change
3
- create_table :jellyfish_manageiq_database_products do |t|
4
- t.timestamps
5
- t.string :cloud_provider
6
- t.string :chef_role
7
- t.integer :service_catalog_id
8
- t.integer :service_template_id
9
- t.string :db_instance_class
10
- t.string :engine
11
- t.float :allocated_storage
12
- t.string :storage_type
13
- t.string :availability
14
- end
15
- end
16
- end
@@ -1,14 +0,0 @@
1
- class CreateJellyfishManageiqBigDataProducts < ActiveRecord::Migration
2
- def change
3
- create_table :jellyfish_manageiq_big_data_products do |t|
4
- t.timestamps
5
- t.string :cloud_provider
6
- t.string :chef_role
7
- t.integer :service_catalog_id
8
- t.integer :service_template_id
9
- t.integer :cpu_count
10
- t.float :disk_size
11
- t.float :ram_size
12
- end
13
- end
14
- end
@@ -1,13 +0,0 @@
1
- class CreateJellyfishManageiqInfrastructureProducts < ActiveRecord::Migration
2
- def change
3
- create_table :jellyfish_manageiq_infrastructure_products do |t|
4
- t.timestamps
5
- t.string :cloud_provider
6
- t.string :chef_role
7
- t.integer :service_catalog_id
8
- t.integer :service_template_id
9
- t.string :instance_size
10
- t.float :disk_size
11
- end
12
- end
13
- end
@@ -1,13 +0,0 @@
1
- class CreateJellyfishManageiqStorageProducts < ActiveRecord::Migration
2
- def change
3
- create_table :jellyfish_manageiq_storage_products do |t|
4
- t.timestamps
5
- t.string :cloud_provider
6
- t.string :chef_role
7
- t.integer :service_catalog_id
8
- t.integer :service_template_id
9
- t.string :availability
10
- t.string :region
11
- end
12
- end
13
- end