Men and Mice API Client Gem for Ruby

Part of what I am doing these days is integrating Red Hat CloudForms / ManageIQ with the Men and Mice IP address management (IPAM) application. In order to reduce gem dependencies, reduce duplication, and handle some architecture issues I have been working on a client gem that uses the JSON-RPC API provided by Men and Mice.

If you are using Ruby and want to integrate with M&M please check out the gem and provide any feedback you have through Github issues.

The gem:
The source:

Helper utility for ManageIQ/CloudForms Automate

As I do Automate development on RedHat CloudForms I am seeing a lot of copy/paste code which is the opposite of DRY. Our process was to put commonly used code in a starting template for an Automate method. This is nice because someone new to development gains the experience of a nice starting point, but it results in a lot of extra code. We also lose the benefit of bug fixes to the helper methods.

To try and reduce the amount of copy/paste coding going on I created a Ruby gem that contains commonly used code and can be distributed via the standard gem installation mechanism. Its current focus is on logging and a few miscellaneous helpers.

More details can be found in the README on the github repo:

Feel free to try it out and submit bug reports or pull requests.

Getting ManageIQ instance attributes without executing methods/states

I want to use the values from the ProvisionRequestQuotaVerification instance. The problem is that using $evm.instantiate will cause the code to run. This results in an exception or error.

Digging around I found


Which works as long as you know the full path including the domain, but then you can not rely on domain inheritance.

my_instance = $evm.instance_get("/ManageIQ/Infrastructure/VM/Provisioning/StateMachines/ProvisionRequestQuotaVerification/default")

Here is my current workaround:

# Sending a fake message does not invoke the state because it is
# tied to the create message.
fake_message = "doesnotreallywork"
empty_instance = $evm.instantiate("/Infrastructure/VM/Provisioning/StateMachines/ProvisionRequestQuotaVerification/Default##{fake_message}")
# Unfortunately so are the attributes. However, now we know the real
# name of the resolved instance and can use that to get our attributes.
instance_name =
my_instance = $evm.instance_get(instance_name)
$evm.log(:info, "The instance contains: #{my_instance.inspect}

Foreman ESXi Installation Never Completes

In our environment we want to use Foreman to build our OCP hardware. It was working well except that the installation would repeatedly PXE boot to reinstall because Foreman would not know that the PXE portion was complete.

The standard notification code below was failing for some reason.

%post --interpreter=busybox --ignorefailure=true 
wget -O /dev/null <%= foreman_url %>

After running the unattended install in a Fusion VM so I could have console access I reviewed the install log and a misleading message from wget about the URL being bad. After a little digging I determine that the problem was no DNS in the ESXi installer.

Per the documentation this is expected.
Deploying ESXi 5.x using the Scripted Install feature (2004582)

Note: When ESXi 5.x is being installed using a kickstart file via PXE with DHCP enabled; the DNS settings are not available and are not saved in the configuration file.

Following what I have seen in previous installation scripts I implemented a quick fix to the Foreman OS template to add DNS settings to the installer environment so the call works and the build proceeds as expected.

%post --interpreter=busybox --ignorefailure=true 
# Add temporary DNS resolution so the foreman call works
echo "nameserver <%= @host.subnet.dns_primary %>" >> /etc/resolv.conf
echo "nameserver <%= @host.subnet.dns_secondary %>" >> /etc/resolv.conf
wget -O /dev/null <%= foreman_url %>
echo "Done with Foreman call"

OpenZIS installation guide

I have spent a day or so trying to get the OpenZIS project up and running on a CentOS machine. A lack of updated instructions and an older code base made this process harder than I expected.

While I am still investigating if OpenZIS will meet my needs, I wanted to publish what I did as a reference to others who might try to install it. The doc is in my forked version of OpenZIS. Once I have tested things more, I will likely submit a pull request to the author.

Google Book Advanced Search Query Parameters

A reference for those working on Google book searches other than full text queries. Let me know if something is incorrect or missing.

Query Parameter Values
Text Query
as_q All of the words.
as_epq Exact phrase.
as_oq At least one of the words.
as_eq Without the words.
Content Type
as_brr 0=AllBooks, 1=FullView, 3=Limited preview and full view, 4=Public domain only
lr Empty for all languages otherwise a language code.
as_vt Title
as_auth Author
as_pub Publisher
as_sub Subject
Publication Info
as_drrb_is Publication date: q=ANYTIME, b=BETWEEN
as_minm_is Publication minimum month. Jan=1, DeC=12.
as_miny_is Publication minimum year.
as_maxm_is Publication maximum month. Jan=1, DeC=12.
as_maxy_is Publication maximum year.
as_isbn ISBN
as_issn ISSN
num Number of results to return. 10-100 should be safe.