__author__ = 'Admin'

import os
import subprocess
import shutil
import time


def install_tar():
    """


 """
    agent_tar_path = "/root/nova-agent/nova-agent-Linux-x86_64-0.0.1.37.tar.gz"
    installer_path = "/root/nova-agent/"
    nova_agent__process_path = "/etc/init.d/nova-agent"
    nova_agent_path = "/usr/share/nova-agent/"
    if os.path.exists(nova_agent_path):
        subprocess.call(["%s" % nova_agent__process_path, "stop"])

    if os.path.exists(nova_agent_path):
        shutil.move(nova_agent_path, "/tmp")

    subprocess.call(["mv", "%s" % nova_agent_path, "/tmp"])

    subprocess.call(["tar", "-zvxf", "%s" % agent_tar_path])
    time.sleep(5)
    os.chdir(installer_path)
    subprocess.call(["cd", "%s" % installer_path])
    subprocess.call(["sh", "installer.sh"])
    time.sleep(2)
    subprocess.call(["%s" % nova_agent__process_path, "start"])

install_tar()

@@ -199,37 +199,33 @@
 staller_path = %22
-/root
+~
 /nova-agent/%22%0A  
@@ -519,24 +519,25 @@
 /tmp%22)%0A%0A    
+#
 subprocess.c
@@ -576,25 +576,24 @@
 h, %22/tmp%22%5D)%0A
-%0A
     subproce

install agent changes