Posted by: terryhowe | March 14, 2015

Regular Git Pull Requests

I’ve been doing so much OpenStack work lately, I’d forgotten how to do regular old git pull requests from a fork.  A little refresher, add the upstream repo:

git remote add upstream git@github.com:remoteowner:Repo.git

Verify it is there:

git remote -v

Update local information:

git remote update

And now you can see the upstream branches:

git branch -a

Update the local branch to upstream:

git reset --hard upstream/master

Push the upstream to fork ignoring the fact that it won’t be a fast forward:

git push origin +master

Posted by: terryhowe | March 4, 2015

tox pypy No module named gdbm

I don’t know how many times I’ve seen the error from pypy tests “No module named gdbm”.  The cause of this is an incompatibility in the .testrepository.  The solutions are either run the pypy tests first or remove the .testrepository, run the pypy tests, and then run all the tests.

Posted by: terryhowe | February 18, 2015

Grep Files Without Match

I accidentally discovered that grep -L give a list of files that do *not* match the pattern.  That is a pretty neat feature that I hadn’t noticed before.  It has been a while since I looked at the grep man page.  The discovery caused some unwanted side effects though.

Posted by: terryhowe | February 17, 2015

Ubuntu Strip GPS Information out of Images

I always forget how to do this, so time to write it up. First, install the exiftool:
sudo apt-get install libimage-exiftool-perl

Next, remove the exif data:
exiftool -all= picture.jpg

To verify:
exiftool picture.jpg

Posted by: terryhowe | January 16, 2015

OpenStack Client and Neutron Client Patches

I keep running around to different machines and need to patch OpenStack Client and Neutron Client. OSC has a bug where it does not pass the region to the compute client. I submitted a fix that has been merged to main, but not released. Neutron client has a bug where it doesn’t properly handle some keystone v3 authentication domain information. I also submitted a patch for this and it too has been merged, but not released. The patches are:


patch ~/.venv/lib/python2.7/site-packages/openstackclient/compute/client.py <<!
diff --git a/openstackclient/compute/client.py b/openstackclient/compute/client.py
index 3725350..166747d 100644
--- a/openstackclient/compute/client.py
+++ b/openstackclient/compute/client.py
@@ -50,6 +50,7 @@ def make_client(instance):
extensions=extensions,
http_log_debug=http_log_debug,
timings=instance.timing,
+ region_name=instance._region_name,
)

return client
!

patch ~/.venv/lib/python2.7/site-packages/neutronclient/shell.py <<!
diff --git a/neutronclient/shell.py b/neutronclient/shell.py
index 0329d52..9d703b5 100644
--- a/neutronclient/shell.py
+++ b/neutronclient/shell.py
@@ -719,8 +719,8 @@ class NeutronShell(app.App):
project_info = (self.options.os_tenant_name or
self.options.os_tenant_id or
(self.options.os_project_name and
- (self.options.project_domain_name or
- self.options.project_domain_id)) or
+ (self.options.os_project_domain_name or
+ self.options.os_project_domain_id)) or
self.options.os_project_id)

if (not self.options.os_username
!

Posted by: terryhowe | December 23, 2014

fatal error: Python.h: No such file or directory

When running multiple versions of tests this is a common problem caused by not having the correct development package installed. You do a find and you have a version of Python.h, but not the right now. There are potentially several packages you need to install on Ubuntu for python or pypy:


sudo apt-get install python-dev
sudo apt-get install python3-dev
sudo apt-get install python3.3-dev
sudo apt-get install python3.4-dev
sudo apt-get install pypy-dev

With the latest version of pip, devstack is broken with:


Collecting prettytable>0.7
Could not find a version that satisfies the requirement prettytable>0.7 (from versions: )
No distributions matching the version for prettytable>0.7

You’ll need this patch:


diff --git a/tools/fixup_stuff.sh b/tools/fixup_stuff.sh
index 1732ecc..7da3b31 100755
--- a/tools/fixup_stuff.sh
+++ b/tools/fixup_stuff.sh
@@ -79,7 +79,7 @@ function get_package_path {

# Fix prettytable 0.7.2 permissions
# Don't specify --upgrade so we use the existing package if present
-pip_install 'prettytable>0.7'
+pip_install 'prettytable>=0.7'
PACKAGE_DIR=$(get_package_path prettytable)
# Only fix version 0.7.2
dir=$(echo $PACKAGE_DIR/prettytable-0.7.2*)

Outstanding review: https://review.openstack.org/#/c/143504/

Posted by: terryhowe | August 5, 2014

Using OpenStack Python Client to Create a Server on Helion

I’d like to post this up because I am likely to forget the python-openstackclient syntax for creating a server. I’ve been through this before and forgot yet again. Here it goes:


os server create --flavor m1.tiny --image 79a19846-d614-419b-b4f8-cb503bffe8f4 --nic "net-id=fe40196d-9fd7-415c-80a1-204f4d2630b1" serverName --debug

Where 79a19846-d614-419b-b4f8-cb503bffe8f4 is the image and e908c11e-5b96-4c90-86c6-44cd8d371709 is the network. The –nic option is used when it would be nice to have a –network option that uses the append option.

Posted by: terryhowe | June 26, 2014

Git: How to Reset Local Master to Remote

I often forget to create a branch and accidentally commit to my local master branch.  I should write a little shell script or something to reset master to remote:

git fetch origin
git reset --hard origin/master
Posted by: terryhowe | March 21, 2014

Python on OSx with Funky XCode

There are several python packages that fail to install on OSx because of C compile problems.  When I trying to install virtualenv, I ran into this problem:

clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]

I found http://stackoverflow.com/questions/22313407/clang-error-unknown-argument-mno-fused-madd-python-package-installation-fa helped me get around that issue by add the flags to the compile.  

The next issue I had was arround a the ffi library and ffi.h not found.  I added to the flags my path to the ffi include directory.  Your directory may vary.  I ran this to discover the location of the include file: 

find / -name ffi.h

The final results for the flags in my ~/.bashrc :

export CFLAGS="-Qunused-arguments -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/ffi"
export CPPFLAGS="-Qunused-arguments -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/

Older Posts »

Categories

Follow

Get every new post delivered to your Inbox.