I'm working on an Ansible module that will enable Mesos operators to easily 
update resource reservations within the mesos platform. I've got things 
unit tested and validated against a dev cluster. Unfortunately, when I 
install the ansible package locally, some path issues come up. 

How can a update the search path at runtime for a module? I have a package 
under module_utils that contains generated python code from protobuf files. 
In order for the generated code to work, the package search path must start 
at the module_utils directory. Updating the search path in the __init__.py 
for this package works in the dev environment and under test, but not when 
installing ansible locally from my fork. Afterward, I've tried using 
pkg_resources.working_set.add_entries, it does not seem to update the 
search path because the path is not found when I execute my module outside 
of the dev environment. Let me provide an example:

Base module_utils directory:


The generated python code in the mesos package must reference package like 

import mesos.mesos_pb2

In the dev environment, conditionally updating the sys.path to include the 
module_utils directory does the trick, but not in other executing 

Is there a recommended method of updating the search path so it will work 
outside of the development environment? I'm using the generated python code 
to avoid having to deal with JSON as the Content-Type. the generated code 
generates classes that are type checked and makes working with the Mesos 
Operator API a lot more predictable. 

My code can be found here: https://github.com/miroswan/ansible. Of course, 
it is subject to change over time. 

Thanks in advance. 

You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to