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
Available subnets: | |
=================== | |
<% @foreman_subnets.each do |subnet| %> | |
<%= subnet['name'] %>: | |
<%= subnet.to_yaml %> | |
--------------------- | |
<% end %> | |
Configured interfaces: | |
====================== |
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
<% subnet = @host.subnet -%> | |
<% dhcp = subnet.dhcp_boot_mode? -%> | |
real=`ip -o link | grep <%= @host.mac -%> | awk '{print $2;}' | sed s/://` | |
<% if @host.respond_to?(:has_primary_interface) && @host.has_primary_interface? %> | |
cat << EOF > /etc/network/interfaces | |
auto lo | |
iface lo inet loopback | |
auto $real |
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
ForemanTasks::Task.where(:state => :paused, :result => :error).all.select(&:resumable?).each {|t| ForemanTasks.dynflow.world.execute(t.execution_plan.id)} |
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
Simple script to convert puppet text output to yaml so it can be easily uploaded to Foreman using node script. | |
usage: | |
convert_text_facts_to_yaml.rb /tmp/user.yaml > /var/lib/puppet/yaml/facts/user.yaml | |
/etc/puppet/node.rb user |
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
def set_interfaces(parser) | |
# if host has no information in primary interface we try to match it and update it | |
# instead of creating new interface, suggested primary interface mac and identifier | |
# is saved to primary interface so we match it in updating code below | |
if !self.managed? && self.primary_interface.mac.blank? && self.primary_interface.identifier.blank? | |
identifier, values = parser.suggested_primary_interface(self) | |
self.primary_interface.mac = Net::Validations.normalize_mac(values[:macaddress]) | |
self.primary_interface.identifier = identifier | |
self.primary_interface.save! | |
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
AllCops: | |
Include: | |
- "**/*.gemspec" | |
- "**/Rakefile" | |
- "**/Gemfile" | |
- "**/Vagrantfile" | |
- "**/config.ru" | |
Exclude: | |
- "vendor/**/*" | |
- "db/schema.rb" |
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
diff --git a/app/models/compute_resources/foreman/model/openstack.rb b/app/models/compute_resources/foreman/model/openstack.rb | |
index d273cfb..fa998b9 100644 | |
--- a/app/models/compute_resources/foreman/model/openstack.rb | |
+++ b/app/models/compute_resources/foreman/model/openstack.rb | |
@@ -77,6 +77,7 @@ module Foreman::Model | |
boot_from_volume(args) if Foreman::Cast.to_bool(args[:boot_from_volume]) | |
network = args.delete(:network) | |
# fix internal network format for fog. | |
+ args[:nics] ||= [] | |
args[:nics].delete_if(&:blank?) |
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
$ rubocop lib/dynflow | |
... | |
121 files inspected, 1346 offenses detected | |
# this includes stuff like `=->`, `on Work::Step.(step: ~any)`, `define =-> _ do` | |
$ rubocop lib/dynflow | grep lamda | wc -l | |
22 | |
# see yourself by | |
$ rubocop lib/dynflow | grep -i lambda -C 3 |
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
begin | |
require "bundler/inline" | |
rescue LoadError => e | |
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler" | |
raise e | |
end | |
gemfile(true) do | |
source "https://rubygems.org" | |
gem "rails", github: "rails/rails" |
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
// original and I'd say very clear for reader | |
if (a) { | |
return 1 | |
} else { | |
return 2 | |
} | |
// vs accepted by linter but duplicates condition keeping it clear when 2 is returned |
OlderNewer