This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Fog | |
module Vsphere | |
class Compute | |
class Real | |
def create_vm(attributes = {}) | |
# NOW | |
# stufff goes here.... | |
# AFTER | |
CreateVmRequest.new(connection).call(attributes) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { mountNode } from 'foremanReact/common/MountingService'; | |
/** | |
* This tag can be used for mounting one react component from ComponentRegistry | |
* This way, we would decide to rewrite the mounter completely and we would make all components there to the custom tags. | |
*/ | |
class ComponentInRegistryElement extends HTMLElement { | |
connectedCallback() { | |
const mountPoint = document.createElement('span'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/models/compute_resources/foreman/model/vmware.rb | |
# ... | |
def supports_update? | |
true | |
end | |
# ... change to | |
def supports_update? | |
false | |
end | |
# ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# (re)create DB | |
DB=dynflow_example; dropdb -U postgres "$DB"; createdb -U postgres "$DB" | |
# install staff | |
sudo yum install redis | |
sudo systemctl enable --now redis | |
# set DB connection - expect dynflow user with dynflow password | |
export DB_CONN_STRING='postgres://dynflow:dynflow@/dynflow_example' | |
# start dynflow with web dashboard | |
bundle exec ruby ./examples/remote_executor.rb observer | |
# running dynflow dashboard on http://localhost:4567/dynflow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
groups = ActiveRecord::Base.connection.select_all(GROUP_PARAMS_QUERY) | |
# this array is pretty huge - <number of hosts having the parameter matching name> * <type of parameters meeting the criteria> | |
parameters = ActiveRecord::Base.connection.select_all(PARAMS_QUERY) | |
matching_host_ids = [] | |
parameters.group_by(&:first).each do |host_id, params| | |
valid = params.first | |
hostgroup_path = valid[<ancestry_position>] && valid[<ancestry_position>].split('/') | |
# select first matching group | |
grp_param = hostgroup_path && groups.detect{|group| hostgroup_path.include?(group[<id_position>].to_s)} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rails_root = Dir.pwd | |
app_file = File.expand_path('./config/application', rails_root) | |
require app_file | |
rails_env_file = File.expand_path('./config/environment.rb', rails_root) | |
require rails_env_file | |
# require 'dynflow/executors/sidekiq/core' | |
role = nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<tr> | |
<td> | |
<%= f.text_field(:name, ... %> | |
</td> | |
<td> | |
<%= f.text_field(:value, ... %> | |
</td> | |
<td> | |
<%= link_to_remove_fields(_('Remove'), f) if f.object.new_record? %> | |
</td> |
This file has been truncated, but you can view the full file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "TheForemanDevDeps", | |
"version": "2.1.0", | |
"lockfileVersion": 1, | |
"requires": true, | |
"dependencies": { | |
"@babel/code-frame": { | |
"version": "7.8.3", | |
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.8.3.tgz", | |
"integrity": "sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g==", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# test/benchmark/audit_taxed_benchmark.rb | |
# Run by: bundle exec ruby -I"test" test/benchmark/audit_taxed_benchmark.rb | |
require 'test_helper' | |
class AuditTaxedTest < ActiveSupport::TestCase | |
setup do | |
org = FactoryBot.create(:organization) | |
2.times do |k| | |
loc = FactoryBot.create(:location) | |
50.times do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'json' #probably not necessary | |
file_json = JSON.parse('test/static_fixtures/facts/facts.json') | |
host = Host.find(host_id) | |
HostFactImporter.new(host).import_facts(file_json['facts']) |
OlderNewer