Now Playing Tracks

Emacs + Rope for Python Development


Disclaimer: This is more of a note for myself than a proper tutorial or howto, so I make no promises that this will work for you. The setup used through this post was a Mac OS laptop upgraded to the very latest version of the OS.

Ever since I started doing Python development using Emacs, I have unsuccessfully tried to configure Rope, "a python refactoring library"… until last Friday. Turns out I wasn’t too far off the mark during the many iterations I went through to get it done, but the following post was tremendously helpful to me:

Here’s what worked for me:

Now configure Emacs by adding the following lines to your init.el file:

(require ‘pymacs)
(pymacs-load “ropemacs” “rope-“)
(setq ropemacs-enable-autoimport t)

Finally, start up Emacs and make sure to read this document for some examples on how to use Rope.

Using Python to Control Katello

Emacs editor with python code

I usually like to use python to script my day to day tests against Katello (you may have seen some of my previous posts about using the Katello CLI for the same purpose) and I figured I’d start showing some basic examples for anyone else out there who may be interested.

Assuming you have already installed and configured your Katello instance (learn how to do this here) with the default configurations, we now have a few options to proceed:

  1. write and run your scripts in the same environment as your server
  2. install the katello-cli package (pip install katello-cli)
  3. Use git to clone the katello-cli repository (git clone and make sure to include it into your PYTHONPATH.

Option 1 is by far the easiest approach since you should have all the dependencies (namely kerberos and M2Crypto) already installed, but I like Option 3 as it allows me to always have the latest code to play with.

Now we’re ready to write some code! The first thing we’ll do is import some of the Katello modules:

 from katello.client import server
 from katello.client.server import BasicAuthentication
 from katello.client.api.organization import OrganizationAPI
 from katello.client.api.system_group import SystemGroupAPI

Next, we establish a connection to the Katello server ( in my case), using the default credentials of admin/admin:

katello_server = server.KatelloServer(host='', path_prefix='/katello/', port=443)
katello_server.set_auth_method(BasicAuthentication(username='admin', password='admin'))
Let’s now instantiate the Organization API object and use it to fetch the “ACME_Corporation" that gets automatically created for a default installation:
organization_api = OrganizationAPI()
org = organization_api.organization('ACME_Corporation')
print org
{u’apply_info_task_id’: None,
u’created_at’: u’2013-09-12T20:15:06Z’,
u’default_info’: {u’distributor’: [], u’system’: []},
u’deletion_task_id’: None,
u’description’: u’ACME_Corporation Organization’,
u’id’: 1,
u’label’: u’ACME_Corporation’,
u’name’: u’ACME_Corporation’,
u’owner_auto_attach_all_systems_task_id’: None,
u’service_level’: None,
u’service_levels’: [],
u’updated_at’: u’2013-09-12T20:15:06Z’}

Lastly, let’s create a brand new organization:
new_org = organization_api.create(name='New Org', label='new-org', description='Created via API')
print new_org
{u’apply_info_task_id’: None,
u’created_at’: u’2013-09-12T21:48:55Z’,
u’default_info’: {u’distributor’: [], u’system’: []},
u’deletion_task_id’: None,
u’description’: u’Created via API’,
u’id’: 283,
u’label’: u’new-org’,
u’name’: u’New Org’,
u’owner_auto_attach_all_systems_task_id’: None,
u’service_level’: None,
u’service_levels’: [],
u’updated_at’: u’2013-09-12T21:48:55Z’}

As you can see, it is pretty straight forward to use python to create some useful scripts to drive a Katello server, whether you want to populate it with a pre-defined set of data (e.g. default users, roles, permissions, organizations, content, etc) or to test core functionality as I do with Mangonel, my pet project.
Here’s a Gist of the code mentioned in this post, and let me know if this was useful to you.

ANÚNCIO: Final do Planeta GNU/Linux Brasil

The End

Em 2008, depois de algumas discussões sobre o tipo de conteúdo que meu blog estava gerando em alguns agregadores nacionais, eu tomei a decisāo de criar meu próprio agregador com o seguinte objetivo:

Planeta GNU/Linux nasceu da minha necessidade de querer ler blogs de pessoas relacionadas ao movimento Brasileiro de software livre, mas sem a censura bitolada que outros agregadores de blogs usam para filtrar o conteúdo que é publicado.

O critério para entrar no Planeta é super simples: eu tenho de gostar do material! Ao contrário dos outros agregadores que geralmente são vinculados a comunidades ou distribuições, este site aqui é completamente independente e sem censura nenhuma!

Desde entāo eu venho administrando o conteúdo e tentando adicionar material que seja relevante aos meus interesses e daqueles que também acompanham este “planeta”. Mas nos últimos 2 anos tanto o meu tempo como meu interesse por este tipo de fonte de notícias diminuiu bastante e o projeto ficou meio que jogado às traças… até a semana passada quando recebi um e-mail me avisando que estava na hora de renovar o meu domínio. Foi aí que eu resolvi que nāo fazia mais sentido em manter um projeto que eu nāo tenho mais interesse, e em outubro deste ano o Planeta GNU/Linux Brasil deixará de existir.

Agradeço a todos que apoiaram o projeto por tanto tempo e até a próxima :)

Castálio Podcast - Enrico Nicoletto e Rafael Ferreira: Projeto GNOME


Depois de vários meses sem “fora do ar”, tenho o grande prazer em trazer mais um episódio sobre o projeto GNOME! Desta vez convidei o Enrico Nicoletto e Rafael Ferreira para conversar sobre o processo de traduçōes, que mais uma vez promete entregar mais uma versão completamente traduzida para o nosso bom português!

A entrevista aconteceu “na estrada” quando eu estava voltando de viagem, e acabei gravando o episódio de um hotel lá em Richmond no estado da Virgínia. Mesmo com alguns problemas iniciais (teve uma hora que minha conexão caiu, mas eu consegui voltar logo), eu consegui bater um papo super legal com o Enrico e Rafael sobre como todo o processo de traduçōes, desde como eles entraram para a equipe oficial, até como chegaram a ser os administradores da equipe brasileira.

O episódio todo ficou com um pouco mais de 30 minutos, mas para quem quizer assistir o vídeo vocês poderão escutar sobre outros temas que acabaram ficando de fora na hora da ediçã0 (devido ao tamanho final do podcast), como seus planos para o futuro da equipe.

Escute agora: [MP3] [Ogg] [AAC] [Youtube]

Populating a Katello instance using the CLI

Lately I have been asked a lot about my previous script to automatically populate a Katello server instance with real data (hi reyc!) I wrote that a while back and though it still does contain some helpful commands, I figured it was about time I updated it. Well, it took me longer than I expected to find some time and clean it up, but I think I can now show you a brand new script which also includes the extra feature of downloading a manifest file directly from Red Hat's portal and importing it as part of the process.

Currently the script assumes that you have the following information (either as environmental variables or substituted into the script:

RHN_USERNAME: A valid username for

RHN_PASSWORD: A valid password for

DISTRIBUTOR: An existing distributor UUID with access to Red Hat Enterprise Linux 6 Server products

The new script is know to work with the very latest Katello nightly build. If you have any suggestions or constructive feedback, feel free to leave me a comment here or fork the gist and send me a pull request!

Adventures in the Music Streaming World

These last couple of years have brought (along with some new wrinkles and occasional grey hairs) some interesting changes on how I manage and maintain my “digital belongings”. For a long while I used to worry about backing up and storing in a safe place all the files, photos, books, movies and music I’ve collected through the years. I have also managed to collect a variety of different external USB hard drives to keep up with this digital sprawl, where for each iteration the next device would increase in size and sometimes in speed compared to the current one. It got to a point where I got tired of the backup/restore game and found myself paying less and less attention to the things I had spent so much time maintaining.

Music was one of the last items that I eventually stopped backing up. One day last year I took my entire collection of approximately 9000 (legal) songs and uploaded them to Google Play! The very next time I re-installed my desktop I didn’t have to restore my music collection anymore. All I needed was a net connection and I was off to listening to my tunes! I also had full access to that collection via my Android phone and laptop! Triple yummy! Sure, without net access I would be out of luck, but I could always keep a smaller subset of my collection around if I wanted to listen to anything while offline.

After a while I noticed that I seldon played my own tunes, often spending more and more of my music listening minutes on sites such as Pandora and Grooveshark to experience new types of music and genres. At one point I found myself subscribing to Pandora, Rdio and Spotify, looking for what in my opinion would provide me with the best listening experience. After about a month I think I have finally found the combination that gets me closer to that goal: Pandora + Spotify.

A little background though. I have been a Pandora (non-paying) customer for many years now and I can’t say enough about the music quality and the variety that you can get for this service! I mean, for the completely FREE option (with the occasional advertisement) you get to listen to (what feels like to be) hand picked songs that match whatever criteria you can come up with! Be it a song, a word, an artist or an album, Pandora’s matching algorithm is by far the best I’ve seen out there. Period! It is because of this plus the fact that I can access it from anywhere and any device with net access that I became a paid customer.

But how about those times when I specifically want to listen to a given song or album or even make a playlist with some of my favorite jams? After a while I learned a nice trick that lets you sample an album from Pandora but that wasn’t enough for what I wanted to do. So Grooveshark was definitely a great find for me and for a while I really enjoyed the freedom and wide selection that it offered me for free. Something really simple but it also made a difference for me was that I could “scrobble” the music I listened to my account, something that Pandora doesn’t do. But alas, I couldn’t listen to my playlists on the go or even using my phone, so I started looking for options.

Now Rdio impressed me right away for being exactly what Groveshark was but with the added capability of being available on multiple platforms, and including some of the newest and latest releases! The pricing model was a bit more expensive than Pandora, but it did give me the ability to create my own playlists and interact with my friends via different social networks. I definitely enjoyed the experience and would have stuck with if it wasn’t for the small music collection that is available right now. I understand that Rdio tries to add as many new (and old) titles as it can, but at the end of the day, I couldn’t always find what I was looking for.

Spotify was the “dark horse” during my experimentation, mostly because it didn’t offer a first class client for Linux. There was a “half baked” client out there that never worked for me/or crashed too many times… I even ran the Windows client via Wine for the first 2-3 weeks but it felt “dirty” to pay for a service that would not run natively or provide a decent support for my platform. The Android and iOS apps worked like a charm, but I spent the bulk of my days in front of a Fedora box and listening to music from my phone was not going to cut it for me. The music variety is definitely much larger that what Rdio offers and it even has its own “Radio” streaming that provides something similar to what Pandora does. But the matching algorithm is still light-years behind Pandora and I often found myself wondering how certain songs and genres ended up in the “station” I was listening to.

After about a month into the experiment, it looked like I was going to keep Pandora and Rdio to get great music selection and variety (Pandora), web front end access and multi-platform support (Pandora, Rdio), and playlists (Rdio)… until a co-worker mentioned that Spotify had just announced their web based player! All of a sudden Spotify went from being in last place to bumping Rdio out of the equation!

Spotify web player

So now I am using both Pandora and Spotify at home and on the go (Spotify lets you download your playlists for offline listening) and so far the experience has definitely been positive. I feel that the streaming quality and variety has provided me with many enjoyable hours of music while I work and even my kids have started experimenting with Pandora as they get more exposure to the musical world. And if I ever feel like listening to some of my own music, some of which is not yet found on Spotify, I can always turn to Google Play… and I definitely enjoy not having to manage my backups anymore. :)

Another concert for my oldest kid. The best part: she really likes to play the violin; it is not something we pushed her to do.

Perks of being a polyglot

Yesterday I had one of those “once in a a lifetime” opportunities, thanks to my wife who dragged me to a presentation hosted by the University of North Carolina. The presentation by Dr. Eduardo Torres Cuevas, titled “Preserving Cuba’s Cultural Heritage in the 21st Century” attracted a small gathering, apparently mostly made up of UNC staff and students who are currently enrolled in one of their languages courses. I wasn’t really sure what to expect from it, but being the supportive husband that I am, I signed off from work a bit earlier and together with our 2 kids we drove to the main campus.

The entire lecture was done in Spanish while a translator tried her best to keep up with Dr. Cuevas’ detailed and humored style of prose, as he told us about the history behind Cuba’s National Library. I must tell you, being a “real time” translator is not an easy task, and though Dr. Cuevas tried to slow things down so she could do her job in a timely fashion, she still had to summarize a lot of what was being said in order to keep up with him. Sadly, a lot of the “good stuff” was never mentioned and/or was completely lost in translation.

Dr. Cuevas was an excellent speaker and was able to quickly put everyone at ease right away and transport us to the Havana of the 1950s. The entire lecture lasted approximately 50 minutes but in reality it felt more like a small fraction of that! I could tell that he is extremely passionate about preserving the Cuban cultural heritage for posterity, and together with a strong character and charisma, I dare say that everyone in attendance was completely captivated by his stories as if in a trance.

Now, let me remind you of one minor detail I mentioned early on that you may have overlooked: everything was in Spanish, a language which though not completely unfamiliar to me, is not my first or second language in order of fluency (Brazilian Portuguese and English in this order if you’re wondering what my first and second languages are). Sure, there was a translator, but after the first 3 minutes I completely ignored her voice and focused completely on Dr. Cuevas. Eventually, the translator’s voice became white noise or just an annoyance, as we would have to stop the flow of the lecture in order for her to turn beautiful story telling-style prose to a short. almost. dry. list. of. facts. and. numbers!

I feel extremely lucky that I was able to not only meet but hear someone who may be a very important person in the history of Cuba. I also feel extremely lucky that I was able to follow and understand the entire presentation in the “original format” without the need for “caption” or any other aid. Had I relied solely on translations, I would have never really gotten all the little jokes, nuances and true meaning behind the words uttered by the gentleman from Havana… and most likely would not feel this great urge I now feel to make Cuba, and specially the National Library of Cuba, my choice for the next time I go anywhere outside the States for vacation!


Castálio Podcast: Everaldo Canuto: Toca do Canuto


Eu conheci o Everaldo em uma tarde super calorenta durante a abertura do evento GUADEC nas Ilhas Canárias. O mais interessante foi que não demorou mais que um dia para que nossa amizade se tornasse igual aquelas amizades que fazemos quando criança… aquelas pessoas que não importa o tempo ou a distância, você sempre fica feliz de encontrar e bater um papo!

O Everaldo teve uma das oportunidades que eu sempre sonhei em ter: trabalhar lado a lado com o Miguel de Icaza, um dos fundadores do Projeto GNOME, figura quase que mitológica do mundo do software livre e hoje empresário com várias companhias de sucesso em seu histórico! Ele também trabalhava com a tecnologia .NET numa época quando qualquer coisa que fosse remotamente relacianada à Microsoft era motivo para perseguição e “trollage” pelos apoiadores mais zelosos do Linux. Durante grande parte de nosso bate-papo, conversamos sobre como que ele foi parar na Novell trabalhando para a equipe do Miguel, como era o dia-a-dia lidando com o sentimento anti- Microsoft, quais tecnologias ele recomenda para quem está começando a trabalhar na área de TI, o “problema” do Java, e sobre seu mais novo projeto,Toca do Canuto.

Assista o vídeo da entrevista aara ver a nossa conversa na íntegra, sem edição e escutar algumas coisas que não foram incluídas no podcast.

Escute agora: [MP3] [Ogg] [AAC] [Youtube]

Castálio Podcast: Alexandre Gaigalas: Yahoo


Seja bem-vindo à mais um episódio, desta vez com o Alexandre Gaigalas que trabalha como engenheiro de software da Yahoo no Brasil! Durante nosso bate-papo conversamos sobre o que ele faz na Yahoo, em quais projetos que trabalha, e acabei descobrindo que ele é mais um exemplo de uma pessoa que teve seu trabalho perante uma comunidade de software livre reconhecido, levando-o a ser indicado para trabalhar em uma companhia de nome! Conversamos sobre o recente anúncio que a CEO Marissa Mayer fez, declatando que não se poderá mais trabalhar remotamente na Yahoo, sobre o efeito que isso teve na moral dos empregados, e como que a sua vinda está transformando a companhia em uma empresa mais moderna e com mais atenção à qualidade de seus produtos e bem-estar de seus empregados.

Mais uma coisa bacana que aconteceu durante a gravação foi um commit que o Alexandre fez ao-vivo para o código do Respect Doc em homenagem ao podcast! :)

Também falamos de programação RESTfulweb semântica, o Respect Project e seu Top 5!

Escute agora: [MP3] [Ogg] [AAC] [Youtube]

To Tumblr, Love Pixel Union