Skip to content

Instantly share code, notes, and snippets.

Michael DeHaan mpdehaan

Block or report user

Report or block mpdehaan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:7ce983b5f8edea5f391d75f378dbaa03
# push mode will look about like this:
if __name__ == '__main__':
inventory = TomlInventory("inventory/inventory.toml")
inventory.ssh([WebServerRole(), AnotherRole() ])
# if you want to run check mode, you can still access it, though it is not the default:
inventory.ssh([WebServers(), AnotherRole() ], check=True)
View gist:c0d8f3381a729a4b04c711f92ab3e856
# BEFORE
class FooRole(Role):
def set_variables(self):
return dict(
x=5
)
def set_resources(self):
View gist:035820f9c2322fe659178faa87ae033d
_build_tuple('markupsafe._speedups'): could not locate source
ModuleResponder(Router(Broker(0x10340e860))): refusing to serve stdlib module 'pathlib'
Message(0, 1, 1, 1001, 0, b'\x80\x02cmitogen.core\n_unpickle_call_error\nq\x01X\xe6\x06\x00\x00except'..1817)
Traceback (most recent call last):
File "push_demo.py", line 55, in <module>
Cli(Demo())
File "/Users/michaeldehaan/Devel/opsmop/opsmop/client/cli.py", line 47, in __init__
self.go()
File "/Users/michaeldehaan/Devel/opsmop/opsmop/client/cli.py", line 103, in go
api.apply()
View gist:ee37df93e988072b0fa53dbff5fb98ed
[groups.bastions.hosts]
"bastion.example.com" = ""
[groups.rack1.hosts]
"rack1-top.example.com" = "opsmop_via=bastion.example.com"
"rack1-101.example.com" = ""
"rack1-102.example.com" = ""
[groups.rack2.hosts]
"rack2-top.example.com" = "opsmop_via=bastion.example.com"
View opsmop_cla
BACKGROUND
Thank you very much for your interest in contributing to Vespene. The purpose of the OpsMop community is work together to create great software we can all share and use.
Vespene is licensed under the Apache 2.0 Software License.
AGREEMENT
By contributing your code to OpsMop you grant the Michael DeHaan LLC a non-exclusive, irrevocable, worldwide, royalty-free, sublicenseable, transferable license under all of Your relevant intellectual property rights (including copyright, patent, and any other rights), to use, copy, prepare derivative works of, distribute and publicly perform and display the Contributions on licensing terms of the current license.
View gist:87d0ea05ed11a9b723d555a566d27ee3
# I don't know about this?
# most people should prefer the Python DSL
# but what if some teams don't want to learn Python?
# here's an OPTIONAL idea for a new capability
# ==================
class FooRole(Foo):
def set_bundles(self):
View gist:2141f627784bed7ba432fab7b853cf4d
(env) llamaforge:opsmop michaeldehaan$ python bin/opsmop apply demo/conditionals.py
-----------------
1. File: /tmp/foo1.txt (signals: file1changed)
actions planned: (['chmod'])
result: ok
signals: file1changed
-----------------
2. File: /tmp/foo2.txt (signals: file2changed)
executing: (sha1sum /tmp/foo2.txt)
View gist:f8c85b0af733598f1d3d36ca09128ce5
# is there a better way to write all the code in magic_imports.py to re-surface a lot of deeply nested
# symbols at the top level?
# ======
# magic_imports.py
# this is just an example but there could be 20 different classes here
# the purpose is to import all the symbols so any file that uses them doesn't have to deal with the full path
from long.stupid.path import Glorp as _Glorp
from long.other.stupid.path import Blarg as _Blarg
View gist:846f4e4ddcf60a1566677a3471dcce0a
def execute_command(build, command, input_text=None, env=None, log_command=True, output_log=True, message_log=False, timeout=None):
"""
Execute a command (a list or string) with input_text as input, appending
the output of all commands to the build log.
"""
timeout_cmd = get_timeout()
shell = True
if type(command) == list:
View gist:2cc868b99c90ea26dd7913a70a07f1d1
BACKGROUND
Thank you very much for your interest in contributing to Vespene. The purpose of the Vespene community is work together to create great software we can all share and use.
Vespene is licensed under the Apache 2.0 Software License.
AGREEMENT
By contributing your code to Vespene you grant the Michael DeHaan LLC a non-exclusive, irrevocable, worldwide, royalty-free, sublicenseable, transferable license under all of Your relevant intellectual property rights (including copyright, patent, and any other rights), to use, copy, prepare derivative works of, distribute and publicly perform and display the Contributions on licensing terms of the current license.
You can’t perform that action at this time.