Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

adam@desktop:~/src/manageiq/manageiq$ rails s
** override_gem("byebug", :require=>"byebug") at /home/grare/adam/.bundler.d/byebug.rb:1
** override_gem("manageiq-ui-classic", :path=>"/home/grare/adam/src/manageiq/manageiq-ui-classic") at /home/grare/adam/src/manageiq/manageiq/bundler.d/overrides.rb:12
=> Booting Puma
=> Rails 5.2.4.4 application starting in development
=> Run `rails server -h` for more startup options
** ManageIQ master, codename: Lasker
Puma starting in single mode...
* Version 4.3.7 (ruby 2.7.2-p137), codename: Mysterious Traveller
* Min threads: 5, max threads: 5
# cat /etc/login.defs
#
# Please note that the parameters in this configuration file control the
# behavior of the tools from the shadow-utils component. None of these
# tools uses the PAM mechanism, and the utilities that use PAM (such as the
# passwd command) should therefore be configured elsewhere. Refer to
# /etc/pam.d/system-auth for more information.
#
# *REQUIRED*
@agrare
agrare / gist:0164a34935d6aee5dadc0e85c635e5ef
Created September 22, 2020 00:53
Before Validation Autosave
class Dog < ApplicationRecord
has_one :cat, autosave: true
before_save :ensure_cat
after_save :save_cat # Without this the before_validation on Cat isn't called
def ensure_cat
build_cat unless cat
end
adam@desktop:~/bcrypt-ruby$ rake
cd tmp/x86_64-linux-gnu/bcrypt_ext/2.7.1
/usr/bin/ruby2.7 -I. ../../../../ext/mri/extconf.rb
checking for rb_str_new_frozen()... yes
creating Makefile
cd -
cd tmp/x86_64-linux-gnu/bcrypt_ext/2.7.1
/usr/bin/make
compiling ../../../../ext/mri/bcrypt_ext.c
gcc -D__SKIP_GNU -DHAVE_RB_STR_NEW_FROZEN -Wdate-time -D_FORTIFY_SOURCE=2 -c -o x86.o ../../../../ext/mri/x86.S
#!/usr/bin/ruby
require 'rbvmomi'
require 'byebug'
def load_vim_types(vim_types_xsd)
vim_types_xsd.dig("schema", "complexType").each_with_object({}) do |type, vim_types|
complex_content = type.dig("complexContent", "extension", "sequence")
next unless complex_content.kind_of?(Hash)
diff --git a/app/models/manageiq/providers/redhat/inventory/collector.rb b/app/models/manageiq/providers/redhat/inventory/collector.rb
index 4dd5ff0..785833e 100644
--- a/app/models/manageiq/providers/redhat/inventory/collector.rb
+++ b/app/models/manageiq/providers/redhat/inventory/collector.rb
@@ -3,7 +3,7 @@ class ManageIQ::Providers::Redhat::Inventory::Collector < ManageIQ::Providers::I
require_nested :InfraManager
require_nested :TargetCollection
- attr_reader :ems_clusters
+ attr_reader :clusters
[----] I, [2018-09-27T10:58:32.002812 #30383:2add769085d4] INFO -- : EMS: [ems_0000000000001], id: [41000000000517] Saving EMS Inventory...
[----] E, [2018-09-27T10:58:32.092405 #30383:2add769085d4] ERROR -- : Error when saving InventoryCollection:<GuestDevice>, strategy: local_db_find_missing_references with strategy: local_db_find_missing_references, saver_strategy: default, targeted: true. Message: PG::UndefinedColumn: ERROR: column lans.switch does not exist
LINE 1: ... = "hosts"."id" WHERE "hosts"."ems_id" = $1 AND (("lans"."sw...
^
HINT: Perhaps you meant to reference the column "lans.switch_id".
: SELECT DISTINCT "lans".* FROM "lans" INNER JOIN "switches" ON "lans"."switch_id" = "switches"."id" INNER JOIN "host_switches" ON "switches"."id" = "host_switches"."switch_id" INNER JOIN "hosts" ON "host_switches"."host_id" = "hosts"."id" WHERE "hosts"."ems_id" = $1 AND (("lans"."switch" IS NULL AND "lans"
[----] I, [2018-09-25T15:22:07.832907 #4134:2ab97e09cf60] INFO -- : MIQ(ManageIQ::Providers::Redhat::InfraManager::Refresh::Strategies::Api4#refresh) Refreshing all targets...
[----] I, [2018-09-25T15:22:07.832972 #4134:2ab97e09cf60] INFO -- : MIQ(ManageIQ::Providers::Redhat::InfraManager::Refresh::Strategies::Api4#refresh) EMS: [env-rhv42-01-mgr], id: [1] Refreshing targets for EMS...
[----] I, [2018-09-25T15:22:07.833055 #4134:2ab97e09cf60] INFO -- : MIQ(ManageIQ::Providers::Redhat::InfraManager::Refresh::Strategies::Api4#refresh) EMS: [env-rhv42-01-mgr], id: [1] ManageIQ::Providers::Redhat::InfraManager [env-rhv42-01-mgr] id [1]
[----] I, [2018-09-25T15:22:07.833137 #4134:2ab97e09cf60] INFO -- : MIQ(ManageIQ::Providers::Redhat::InfraManager#with_provider_connection) Connecting through ManageIQ::Providers::Redhat::InfraManager: [env-rhv42-01-mgr]
[----] I, [2018-09-25T15:22:08.020885 #4134:2ab97e09cf60] INFO -- : MIQ(ManageIQ::Providers::Redhat::InfraManager::Refresh::Strategies::Api4#collect_invento
@agrare
agrare / drb.rb
Created September 20, 2018 15:56
Debug drb.rb
# frozen_string_literal: false
#
# = drb/drb.rb
#
# Distributed Ruby: _dRuby_ version 2.0.4
#
# Copyright (c) 1999-2003 Masatoshi SEKI. You can redistribute it and/or
# modify it under the same terms as Ruby.
#
# Author:: Masatoshi SEKI
@agrare
agrare / graph_gem.txt
Created September 14, 2018 19:48
master.txt
digraph {
subgraph cluster_0 { label = "Layer 0";
cloud_networks; // InventoryCollection:<ManageIQ::Providers::Amazon::NetworkManager::CloudNetwork>
load_balancers; // InventoryCollection:<ManageIQ::Providers::Amazon::NetworkManager::LoadBalancer>
network_routers; // InventoryCollection:<ManageIQ::Providers::Amazon::NetworkManager::NetworkRouter>
availability_zones; // InventoryCollection:<ManageIQ::Providers::Amazon::CloudManager::AvailabilityZone>, strategy: local_db_cache_all
orchestration_stacks; // InventoryCollection:<ManageIQ::Providers::Amazon::CloudManager::OrchestrationStack>, blacklist: [parent], strategy: local_db_cache_all
vms; // InventoryCollection:<ManageIQ::Providers::Amazon::CloudManager::Vm>, blacklist: [genealogy_parent], strategy: local_db_cache_all
}
subgraph cluster_1 { label = "Layer 1";