Skip to content

Instantly share code, notes, and snippets.

View omaciel's full-sized avatar
🎯
Learning

Og Maciel omaciel

🎯
Learning
View GitHub Profile
@omaciel
omaciel / generate_data_test.py
Last active August 29, 2015 13:56
Using SingleDispatcher to overload a random data generator.
# -*- coding: utf-8 -*-
import sys
from robottelo.common.helpers import generate_string
try:
from singledispatch import singledispatch
except ImportError:
print "Please install the singledispatcher module"
@omaciel
omaciel / phantom_test.py
Last active August 29, 2015 13:56
Using PhantomJS for quick UI testing using Selenium's WebDriver. There seems to be an exception that is not bubbling up using https... no issues using http. Here's how to resolve it.
In [1]: from selenium import webdriver
In [2]: service_args = ['--ignore-ssl-errors=true']
In [3]: driver = webdriver.PhantomJS(service_args=service_args)
In [4]: driver.get("https://aaa.bbb.ccc")
In [5]: driver.title
Out[5]: u'Login'
import errno
import os
import socket
import sys
import time
from boto import ec2
# -----------------------------------------------------------------------------
# AMI definitions
@omaciel
omaciel / gist:10059276
Created April 7, 2014 21:20
One-Box Setup Satellite 6 to use libvirt for provisioning
puppet module install -i /tmp domcleal/katellovirt
puppet apply -v -e 'include katellovirt' --modulepath /tmp
export FORWARDERS=$(for i in $(cat /etc/resolv.conf |grep nameserver|awk '{print $2}'); do echo --capsule-dns-forwarders $i;done)
export OAUTH_SECRET=$(grep oauth_consumer_secret /etc/foreman/settings.yaml | cut -d ' ' -f 2)
echo FORWARDERS: $FORWARDERS
echo OAUTH_SECRET: $OAUTH_SECRET
katello-installer --capsule-parent-fqdn $(hostname) --capsule-dns true $FORWARDERS --capsule-dns-interface virbr1 --capsule-dns-zone katellolabs.org --capsule-dhcp true --capsule-dhcp-interface virbr1 --capsule-tftp true --capsule-tftp-servername $(hostname) --capsule-puppet true --capsule-puppetca true --capsule-register-in-foreman true --capsule-foreman-oauth-secret $OAUTH_SECRET --capsule-pulp true --capsule-pulp-oauth-secret $OAUTH_SECRET
@omaciel
omaciel / sprint_report.py
Last active August 29, 2015 13:58
Reports on results for an automation milestone (sprint) for Robottelo
from collections import defaultdict
from functools import partial
import sys
try:
from github import Github
except ImportError:
print "Install PyGithub: sudo pip install PyGithub"
sys.exit(-1)
@omaciel
omaciel / install_sam_on_ec2.sh
Last active August 29, 2015 14:01
Install SAM from CDN on EC2
subscription-manager register --force --username=$USERNAME --password=$PASSWORD --autosubscribe
yum repolist
yum-config-manager --disable rhui*
yum-config-manager --disable rhel-ha*
yum-config-manager --disable rhel-rs*
yum-config-manager --disable rhel-lb*
yum-config-manager --disable rhel-6-server-cf-tools-1-rpms
yum-config-manager --disable *ose*
yum-config-manager --disable *realtime*
yum-config-manager --disable *rhs*
@omaciel
omaciel / gist:2115b886b644409c4e28
Last active August 29, 2015 14:01
Configuring a 389-DS server with VNC access

Setting up a 389-DS Server

Installing needed pieces

Assuming you have a RHEL box:

# Subscribe box to get content
@omaciel
omaciel / gist:3d0bd0a5dc15211007a5
Created May 27, 2014 14:43
Locally running UI tests from Robottelo using Sauce Labs

Step 1

Sauce Connect is a secure tunneling app which allows you to execute tests securely when testing behind firewalls via a secure connection between Sauce Labs’ client cloud and your environment.

Download the version of Sauce Connect that corresponds to your guest's platform. For some reason Sauce Connect v4 never worked for me, so I use Sauce Connect v3 instead.

Step 2

After unpacking Sauce Connect, cd to its directory and start it up using your SauceLabs credentials:

@omaciel
omaciel / import_on_demand.py
Created July 30, 2014 17:45
Python: Import on Demand
def render(engine_id, template, **kwargs):
engines = {
"jinja2": "jinja2",
"mako": "make.template",
}
try:
module = engines[engine_id]
engine = __import__(
module, globals(), locals(), ['Template'], -1)
except (KeyError, ImportError) as err:
@omaciel
omaciel / proxy.sh
Last active August 29, 2015 14:04
Configure Satellite to connect to a proxy
# Block non-proxy traffic from your katello server
# The following environment variables must be set:
# SQUID: the FQDN for your proxy
# PROXY_USERNAME: username for squid
# PROXY_PASSWORD: password for your squid username
export ETH=$(ping -c 1 $(hostname) | grep 'icmp_seq' | awk -F '(' '{print $2}' | awk -F ')' '{print $1}')
export PROXY=$(ping -c 1 $SQUID | grep 'icmp_seq' | awk -F '(' '{print $2}' | awk -F ')' '{print $1}')