Skip to content

Instantly share code, notes, and snippets.

@braoru
Last active August 29, 2015 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save braoru/bcab93b6c506c70730ce to your computer and use it in GitHub Desktop.
Save braoru/bcab93b6c506c70730ce to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
# -*- coding: ascii -*-
"""
package.module
~~~~~~~~~~~~
A description which can be long and explain the complete
functionality of this module even with indented code examples.
Class/Function however should not be documented here.
:copyright: year by my name, see AUTHORS for more details
:license: license_name, see LICENSE for more details
"""
from fabric.api import *
from taskset import task_method
from hurricane.deployables.fabric_driver import FabricDeployable
from hurricane.fabric.decorators import hosts_required
from hurricane.fabric.decorators import ErrorIgnore
import os
import time
import json
from pprint import pprint
class App(FabricDeployable):
"""
Send in parameter environment (production, acceptation or integration)
"""
@task_method
def clean(self, **global_settings):
pass
@task_method
def deploy(self, **global_settings):
pass
@task_method
def install(self, **global_settings):
run('yum install -y kernel-devel')
run('mount -r /dev/cdrom /mnt/')
run(
'cp /usr/src/kernels/$(uname -r)/include/generated/uapi/linux/version.h /lib/modules/$(uname -r)/build/include/linux',
warn_only=True
)
with cd("/tmp/"):
run('tar zxf /mnt/VM*')
run(
'perl ./vmware-tools-distrib/vmware-install.pl -d > /dev/null',
pty=False,
combine_stderr=False,
warn_only=True
)
run('rm -rf /tmp/vm*')
run('unmount -f /dev/cdrom')
run('systemctl daemon-reload')
run('systemctl disable firstboot.service')
def test(self, **global_settings):
time.sleep(5)
test = run('systemctl status vmware-tools.service')
return test.stdout
#we should get only one instance
instance = App(os.path.dirname(os.path.abspath((__file__))))
instance.expose_to_current_module()
if __name__ == '__main__':
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment