Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View elyezer's full-sized avatar

Elyézer Rezende elyezer

View GitHub Profile
@elyezer
elyezer / pep8_examples.py
Last active August 29, 2015 13:56
PEP8 code style examples
# Breaking lines inside (), [], {}
# ================================
# Breaking imediatelly after the opening (, [ or {
# needs only one level of identation
some_big_function_name(
'one', 'two', 'three')
# Breaking after a , then need to align with the opening (, [ or {
some_big_function_name('one', 'two', 'three'
@elyezer
elyezer / gist:9832727
Last active August 29, 2015 13:57
Proposition of a way to create a kind of smoke test
# robottelo.some_module.py
from ddt import data as ddt_data
def data(func, *args):
if some_var:
return ddt_data(func, random.choice(args))
else:
return ddt_data(func, *args)
# test_something.py
@elyezer
elyezer / results.md
Last active August 29, 2015 13:58
Organization ID refactor results

tests/foreman/cli/test_gpgkey.py

Ran 92 tests in 429.900s

OK (SKIP=59)

tests/foreman/cli/test_lifecycleenvironment.py

Ran 32 tests in 534.306s

# test_repository.py
Ran 53 tests in 900.826s
OK (SKIP=9)
# test_syncplan.py
Ran 72 tests in 1143.489s
@elyezer
elyezer / bootstrap.sh
Last active August 29, 2015 13:58
Provision Fedora 20 to run vagrant boxes based on libvirt provider
# Install required packages
sudo yum install @virtualization
sudo systemctl start libvirtd
# Install vagrant
wget https://dl.bintray.com/mitchellh/vagrant/vagrant_1.5.2_x86_64.rpm
sudo yum install vagrant_1.5.2_x86_64.rpm
vagrant plugin install vagrant-libvirt
# Testing the installation with katello-deploy script
@elyezer
elyezer / vagrant-base-box.md
Last active August 29, 2015 13:59
Guide to create a base CentOS/RHEL vagrant box

Create a new VirtualBox machine

  • 512 RAM
  • 40 GB VDI dynamically allocated hard drive
  • Disable audio
  • Disable USB controller

Installing the OS

Load the DVD image and install the system. By convention the root password is vagrant.

@elyezer
elyezer / metagetattr.py
Last active August 29, 2015 14:00
How to do some additional processing for class attributes
class ApiMeta(type):
def __getattr__(cls, name):
print name
super(ApiMeta, cls).__getattr__(name)
class A(object):
__metaclass__ = ApiMeta
A.some_attr
@elyezer
elyezer / install_foreman_iso_ec2.sh
Last active August 29, 2015 14:01
How to install Foreman from an ISO on Amazon EC2
# Subscribe and prepare repos
subscription-manager register --force --username=$USERNAME --password=$PASSWORD --autosubscribe
subscription-manager subscribe --pool=$POOLID
yum repolist
yum-config-manager --disable "*"
yum-config-manager --enable rhel-6-server-rpms
yum-config-manager --enable rhel-server-rhscl-6-beta-rpms
# Add the public DNS to /etc/hosts
vi /etc/hosts
#!/bin/bash
export SELENIUM_HOST=ondemand.saucelabs.com
export SELENIUM_PORT=4444
export SELENIUM_PLATFORM=Linux
export SELENIUM_BROWSER=firefox
export SELENIUM_VERSION=23
export SAUCE_USER_NAME=<username>
export SAUCE_API_KEY=<api_key>
export SELENIUM_DRIVER="sauce-ondemand:?os=$SELENIUM_PLATFORM&browser=$SELENIUM_BROWSER&browser-version=$SELENIUM_VERSION&username=$SAUCE_USER_NAME&access-key=$SAUCE_API_KEY"

How to configure a jenkins slave. On the slave setup a jenkins user and add the master SSH public key on the authorized_keys file.

useradd -m jenkins
su - jenkins -c "mkdir /home/jenkins/.ssh"
su - jenkins -c "chmod 700 ~/.ssh"
su - jenkins -c "chmod 600 ~/.ssh/*"
su - jenkins -c "restorecon -R -v ~/.ssh"
su - jenkins -c "vim /home/jenkins/.ssh/authorized_keys"