Skip to content

Instantly share code, notes, and snippets.

Avatar

Joe Rafaniello jrafanie

View GitHub Profile
@jrafanie
jrafanie / how_to_even_replication_in_pods.txt
Created Oct 1, 2020
How to enable replication in ManageIQ with postgresql 12... should work with pg 10/11 also
View how_to_even_replication_in_pods.txt
How to setup replication in pods with postgresql 12 (very similar to 10):
1) Do the following steps for each region: example: 99 for global, 1 for region
In your local manageiq-pods repo, modify the deploy/crds/manageiq.org_v1alpha1_manageiq_cr.yaml with this information:
...
spec:
applicationDomain: <unique name>
postgresqlImageName: <user/repository_of_pg_12_image such as 'jrafanie/postgresql'>
postgresqlImageTag: <tag such as 'latest'>
@jrafanie
jrafanie / deployment_check.rb
Last active Aug 11, 2020
pod_deployment_checker
View deployment_check.rb
Thread.abort_on_exception = true
STDOUT.sync = true
STDERR.sync = true
module DeploymentCheck
def watch_pod_options
{
:label_selector => "app=manageiq",
:namespace => my_namespace,
# :label_selector => "app=manageiq,worker=true"
@jrafanie
jrafanie / clean_notification_options.rb
Created Jun 28, 2019
Hacky fix for rails 5.0.0-5.0.6 bloated serialized notification options with no longer existing constants causing bugs in rails 5.1
View clean_notification_options.rb
require_relative 'config/environment'
Notification.includes(:subject).all.each do |n|
begin
# Options could have no longer available activerecord/activemodel classes from rails 5.0.0 -> 5.0.6, which will raise an ArgumentError on deserialization
# Fixing these to use 5.0.7+ smaller serialization format without all the private attributes is too hard, especailly since you can only read their YAML strings
# and make changes as a string, not as a Hash.
opts = n.options
rescue ArgumentError
new_value = n.subject.try(:name) || n.subject.try(:description)
View gist:6ca8389fee7f4b9eab33204e3b362bbc
(gdb) call (void)rb_eval_string("puts; puts; Thread.list.each {|t| puts t.backtrace; puts }")
/opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/puma-3.7.1/lib/puma/single.rb:106:in `join'
/opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/puma-3.7.1/lib/puma/single.rb:106:in `run'
/opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/puma-3.7.1/lib/puma/launcher.rb:171:in `run'
/opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/puma-3.7.1/lib/rack/handler/puma.rb:58:in `run'
/opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/rack-2.0.5/lib/rack/server.rb:297:in `start'
/opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.0.7/lib/rails/commands/server.rb:104:in `start'
/var/www/miq/vmdb/app/models/mixins/miq_web_server_runner_mixin.rb:33:in `block in start_rails_server'
View debug_faraday_manageiq_api_client_request_in_workers.rb
# put me in config/initializers
# restart your appliances and it should now log all the net/http interactions
# ***** WARNING *****
# do not run in production, set_debug_output has this warning in ruby docs:
# WARNING This method opens a serious security hole. Never use this method in production code.
require 'manageiq-api-client'
require 'faraday'
require 'faraday/adapter/net_http'
@jrafanie
jrafanie / vcr-webmock-2.rb
Created Oct 26, 2017 — forked from glaszig/vcr-webmock-2.rb
converts vcr cassettes to webmock 2.0-compatible format
View vcr-webmock-2.rb
# converts URIs in vcr cassettes from uri-based basic auth
# to header-based basic auth to be compatible with webmock 2.0.
# it will create a basic auth header with an ERB tag
# to keep user and password be editable.
#
# Authorization: Basic <%= Base64.encode64("user:password").chomp %>
#
# may not work if using VCR's filter_sensitive_data.
# in that case use https://gist.github.com/ujh/594c99385b6cbe92e32b1bbfa8578a45
#
@jrafanie
jrafanie / sexp_processor_4_9_0_vs_4_10_0.diff
Created Oct 2, 2017
Diff of sexp_processor 4.9.0 vs 4.10.0
View sexp_processor_4_9_0_vs_4_10_0.diff
diff --git a/sexp_processor-4.9.0/History.txt b/sexp_processor-4.10.0/History.txt
index b8e355f..23c21e2 100644
--- a/sexp_processor-4.9.0/History.txt
+++ b/sexp_processor-4.10.0/History.txt
@@ -1,3 +1,52 @@
+=== 4.10.0 / 2017-07-17
+
+* 2 major enhancements:
+
+ * Added experimental pattern matcher to Sexp. Forked from sexp_path.
@jrafanie
jrafanie / pgbouncer_setup.txt
Created Jul 7, 2017
initial setup of pgbouncer with manageiq
View pgbouncer_setup.txt
yum install http://yum.postgresql.org/9.5/redhat/rhel-7-x86_64/pgdg-redhat95-9.5-2.noarch.rpm
yum install pgbouncer
vim /etc/pgbouncer/pgbouncer.ini
[databases]
...
@jrafanie
jrafanie / update_settings.rb
Last active Jun 15, 2017
Change ManageIQ server settings from a single location
View update_settings.rb
# 1) you'll need https://github.com/ManageIQ/manageiq/blob/master/tools/configure_server_settings.rb
# 2) copy this file to /var/www/miq/vmdb/tools
# 3) Then cd to vmdb via the 'vmdb' command alias
# 4) Create a list of miq_servers table ids for all of the target servers. I use 1000000000001 here.
# Or just do them all:
# ids = MiqServer.pluck(:id)
# 5) run this script in bin/rails console (if copy/paste works) or put this script into a file, update_settings.rb, in vmdb and run it using bin/rails r 'update_settings.rb'
# 6) Repeat this process for each region/database.
ids = %w(
@jrafanie
jrafanie / loaded_features.txt
Created Jun 12, 2017
$LOADED_FEATURES in generic worker after for do_work loop
View loaded_features.txt
/Users/joerafaniello/.gem/ruby/2.4.1/bundler/gems/manageiq-automation_engine-0f8c8a48f536/lib/manageiq-automation_engine.rb
/Users/joerafaniello/.gem/ruby/2.4.1/bundler/gems/manageiq-content-706f32ca26b7/lib/manageiq-content.rb
/Users/joerafaniello/.gem/ruby/2.4.1/bundler/gems/manageiq-gems-pending-5cc19a6b852a/lib/gems/pending/util/miq-xml.rb
/Users/joerafaniello/.gem/ruby/2.4.1/bundler/gems/manageiq-gems-pending-5cc19a6b852a/lib/gems/pending/util/xml/miq_rexml.rb
/Users/joerafaniello/.gem/ruby/2.4.1/bundler/gems/manageiq-gems-pending-5cc19a6b852a/lib/gems/pending/util/xml/xml_diff.rb
/Users/joerafaniello/.gem/ruby/2.4.1/bundler/gems/manageiq-gems-pending-5cc19a6b852a/lib/gems/pending/util/xml/xml_hash.rb
You can’t perform that action at this time.