Skip to content

Instantly share code, notes, and snippets.

View ohadlevy's full-sized avatar

Ohad Levy ohadlevy

  • Red Hat
  • Israel
View GitHub Profile
commit e12c5a71dbbea0699e8c2925396a192a7af4ecf4
Author: Ohad Levy <[email protected]>
Date: Wed Nov 28 12:18:45 2012 +0200
minor cleanups
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 19c1f93..6b6057d 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
#!/bin/bash
ID=$1
EDITOR='vim'
if [ -z "$ID" ]; then
echo "Must define ID, listing templates instead"
hammer template list
echo "please execute $0 <ID>"
exit 1

Hello all,

it is finally here. Foreman 1.3 has been released.

Improvements were made in the installation process, API, scalability (for importing reports and facts see bellow), existing hosts mapping to compute resources, and more. There is now a new official CLI.

Upgrade needs your attention, please read BEFORE YOU UPGRADE section bellow first.

NOTE: This server is under puppet control! Local changes may be lost.
Running <%=physicalprocessorcount %> <%= processor0.gsub(/ +/,' ') rescue hardwareisa %> on <%= operatingsystem %> <%= operatingsystemrelease %>
This host belongs to the <%= organization rescue 'None' %> organization,
its role is <%= hostgroup rescue 'unknown' %>, its located at <%= location rescue 'unknown' %> and owned by <%= owner_name %> (<%= owner_email %>)
<% if compute -%>
Running on <%= compute %>
<% end -%>
hammer discovery list
No permissions to create log dir /var/log/hammer
File /var/log/hammer/hammer.log not writeable, won't log anything to the file!
---|-----------------|-------------------|----------------------|--------|--------------|---------
ID | NAME | MAC | LAST REPORT | SUBNET | ORGANIZATION | LOCATION
---|-----------------|-------------------|----------------------|--------|--------------|---------
3 | mac28d2446939a9 | 28:d2:44:69:39:a9 | 2014-06-16T09:08:22Z | | DemoOrg | TLV
---|-----------------|-------------------|----------------------|--------|--------------|---------
require 'facter/util/ip'
Facter::Util::IP.get_interfaces.each do |interface|
Facter.debug("Running ethtool on interface #{interface}")
output = (Facter::Util::Resolution.exec("ethtool #{interface} 2>/dev/null"))
attributes = {}
output.each_line do |line|
next if line.nil? or line == ""
case line.strip
when /Speed: (.*)Mb/
Provide a brief description of the change in the first line.
Insert a single blank line after the first line.
Optionally, provide a detailed description of the change in the following lines, breaking paragraphs where needed.
@ohadlevy
ohadlevy / gist:a6d5f8c5dadb318e129a
Created October 2, 2014 19:26
pull request stats
require 'octokit'
class PullRequestStat
attr_reader :project
Octokit.auto_paginate = true
def initialize project
@project = project
end
#!/usr/bin/env ruby
require 'graphite-api'
require 'graphite-api/core_ext/numeric'
require './pull_request_stats'
# Or use the built-in one
GraphiteAPI::Logger.init(
:level => :debug,
:std => STDOUT
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
extractArray: function(store, type, payload) {
// 'foreman-experimental-ui@model:setting:'
var wrapped_payload = {};
var model_name = type.toString().split(":")[1];
wrapped_payload[model_name] = payload['results'];
// TODO: handle additional API result (params, counters etc)
return this._super(store, type, wrapped_payload);