Jul
06
2017
0

How to Install mysql-connector for Python

For several months Python mysql-connector has been broken when attempting a install from pip.  In truth I’ve only tried Python 3, CentOS 6/7 and Fedora 21; in fact, this could be a more wide spread.  The simple solution is to install an earlier version.  The purpose of this post is to be a quick reminder of which is the most recent working version!

(more…)

Jun
26
2017
0

How to handle Python 3 Fabric exceptions with a Decorator

Python’s Fabric module is an easy and efficient way for task based automation.  I use it to automate the installation of VoIP phone systems on CentOS 6/7.  In a nut shell, Fabric executes shell commands over SSH.  It also can be used to automate local tasks.  The purpose of this article is to highlight the basic process of capturing Fabric exceptions(try/except) using a wrapper function called a decorator.  A few well placed decorators can save lot of time coding the same thing over and over(like capturing a specific error). 

Most of you in the know about Python/Fabric probably  will find my examples trivial, but I had to dig to find the Fabric exception environment variable.  I’m sure it’s somewhere on the Fabric site… but I gave up after 30 minutes.  So hopefully you will find this post useful either way!

If you need help installing Python3, pip3 and Fabric please refer to my previous post.

Goals of this Post:

  • create a simple Fabric function that creates a directory
  • create a Fabric exception
  • create Decorator for adding exception handling

Lets start with a basic fabfile.py: 

(more…)

Jun
08
2017
0

How to Install and Configure Basic Git Server on CentOS 6

Git has changed my life.  I’m not exaggerating.  I work with a lot of ‘one off’ scripts (BASH, PHP, and Python).  They are spread out among systems and developed from my workstation and(sometimes) laptop.  I spent 15 years keeping multiple versions and copies of the same scripts spread between systems.  Looking back it seems Crazy!

While I’ve known about Git for years, but I had no idea how badly I needed it until I interviewed for a contract and the interviewer repeatedly mentioned Git as a crucial part of their development process.  I admitted to him that I didn’t use it, but I would set it up myself and answer his questions in the next interview.  I installed it and set out to learn the centralized Git workflow(similar to SVN; one master setup).  There are other workflows and I recommend taking a look at this post if you are curious: https://www.atlassian.com/git/tutorials/comparing-workflows  

Goals of this Post:

  • Install  and configure basic Git for centralized workflow

 

(more…)

Written by mattb in: Automation,Linux | Tags: , , , , ,