Skip to content

Instantly share code, notes, and snippets.

View ohadlevy's full-sized avatar

Ohad Levy ohadlevy

  • Red Hat
  • Israel
View GitHub Profile
# Template sensor for values of power import (active_power > 0)
charging_amps:
friendly_name: "desired charging amps "
unit_of_measurement: 'A'
value_template: >-
{%- set min = 0 -%}
{%- set amps = min -%}
{%- set max = 13 -%}
{%- set voltage = ((states('sensor.tesla_charger_voltage') |float )) -%}
{%- set export = ((states('sensor.power_export') |float) / voltage ) -%}
#! /bin/sh -ex
IMG_URL=$1
IMAGE='/tmp/image.iso'
BASE_URL='http://192.168.2.160:8080'
IPXE_DIR='/tmp/ipxe'
KERNEL_OPTS='random.trust_cpu=on rd.luks.options=discard ignition.firstboot ignition.platform.id=metal console=tty0 console=ttyS0,115200n8'
ISO_MNT=`mktemp -d`
mkdir -p $IPXE_DIR
#! /usr/share/foreman/script/rails runner -e production
Host.all.each do |host|
next unless host.dhcp?
print "#{host}..."
dhcp_record = host.dhcp_record
if dhcp_record.valid?
puts "VALID"
elsif dhcp_record.conflicting?
puts "CONFLICT"
#! /bin/sh -e
URL=$1
MOUNT='mount -o loop,ro image'
KERNEL='images/vmlinuz'
INITRD='images/initramfs.img'
KERNEL_ARG='mitigations=auto,nosmt systemd.unified_cgroup_hierarchy=0 coreos.liveiso=fedora-coreos-31.20200319.dev.1 rd.neednet=1 ip=dhcp ignition.firstboot ignition.platform.id=metal'
TMP=`mktemp -d`
SELinux is preventing 11-dhclient from add_name access on the directory ntp.conf.predhclient.wlp58s0.
***** Plugin catchall (100. confidence) suggests **************************
If you believe that 11-dhclient should be allowed add_name access on the ntp.conf.predhclient.wlp58s0 directory by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# ausearch -c '11-dhclient' --raw | audit2allow -M my-11dhclient
react-dom.production.min.js:187 Error: No translation key found.
at p.dcnpgettext (jed.js:260)
at p.gettext (jed.js:172)
at t.translate (I18n.js:62)
at LayoutHelper.js:38
at Array.forEach (<anonymous>)
at t.combineMenuItems (LayoutHelper.js:30)
at LayoutActions.js:31
at index.js:8
at bindActionCreators.js:3
+----------------------+--------+--------+---------+---------+-----+-------+
| Name | Lines | LOC | Classes | Methods | M/C | LOC/M |
+----------------------+--------+--------+---------+---------+-----+-------+
| Controllers | 14427 | 11896 | 131 | 1357 | 10 | 6 |
| Helpers | 4824 | 4133 | 1 | 520 | 520 | 5 |
| Jobs | 85 | 73 | 4 | 9 | 2 | 6 |
| Models | 20714 | 16022 | 173 | 2230 | 12 | 5 |
| Mailers | 185 | 152 | 5 | 15 | 3 | 8 |
| JavaScripts | 3797 | 3355 | 0 | 265 | 0 | 10 |
| Libraries | 6551 | 5300 | 95 | 498 | 5 | 8 |
019-08-26T08:31:30 [I|app|27292dbf] Started GET "/audits" for 10.35.2.167 at 2019-08-26 08:31:30 +0100
2019-08-26T08:31:30 [I|app|27292dbf] Processing by AuditsController#index as HTML
2019-08-26T08:31:36 [I|app|27292dbf] Rendering audits/index.html.erb within layouts/react_application
2019-08-26T08:31:39 [I|app|27292dbf] Rendered audits/index.html.erb within layouts/react_application (2634.7ms)
2019-08-26T08:31:39 [W|app|27292dbf] Action failed
| ActionView::Template::Error: Mysql2::Error::ConnectionError: MySQL server has gone away: SELECT `audits`.* FROM `audits` WHERE (((`audits`.`auditable_type` IN ('Architecture', 'Bookmark', 'ComputeAttribute', 'ConfigGroup', 'ConfigGroupClass', 'HostClass', 'HostConfigGroup', 'HostgroupClass', 'Image', 'JobInvocation', 'LookupKey', 'LookupValue', 'Model', 'Nic::Bridge', 'Nic::Managed', 'Operatingsystem', 'PuppetclassLookupKey', 'Setting', 'SshKey', 'Taxonomy', 'Template', 'Usergroup', 'VariableLookupKey') OR `audits`.`auditable_type` IN ('AuthSource', 'ComputeRe
@ohadlevy
ohadlevy / gist:674623
Created November 12, 2010 20:29
script to automate creation of machines, including dns, dhcp, tftp, foreman and puppet
#!/usr/bin/ruby
require "rubygems"
require "rest_client"
require "json"
require "uri"
fqdn = ARGV[0] || raise("Must define a fqdn")
mac = ARGV[1] || raise("Must define a mac")