Esempio n. 1
0
def requirements():
    """ Execute requirement files with pip.
	"""
    with manage_fabric_execution():
        with project():
            output = run('ls requirements/')
            files = output.split()
            for file in files:
                run("pip install -r requirements/" + file)
Esempio n. 2
0
    def ntfsfix(self, kvmhost, volume_uuid, output):
        print "Note: Trying to fix NTFS on disk %s on host %s" % (volume_uuid, kvmhost.name)
        try:
            with settings(host_string=self.ssh_user + "@" + kvmhost.ipaddress, warn_only=True):
                for line in output.split('\n'):
                    if "Original error message: mount:" in line:
                        device = line.split(" ")[4]

                        print "Note: Fixing NTFS partition %s disk %s on host %s" % (device, volume_uuid, kvmhost.name)
                        command = "cd %s; sudo guestfish add %s : run : ntfsfix %s" % \
                                  (self.get_migration_path(), volume_uuid, device)
                        return fab.run(command).succeeded
        except:
            return False
    def ntfsfix(self, kvmhost, volume_uuid, output):
        print "Note: Trying to fix NTFS on disk %s on host %s" % (volume_uuid, kvmhost.name)
        try:
            with settings(host_string=self.ssh_user + "@" + kvmhost.ipaddress, warn_only=True):
                for line in output.split('\n'):
                    if "Original error message: mount:" in line:
                        device = line.split(" ")[4]

                        print "Note: Fixing NTFS partition %s disk %s on host %s" % (device, volume_uuid, kvmhost.name)
                        command = "cd %s; sudo guestfish add %s : run : ntfsfix %s" % \
                                  (self.get_migration_path(), volume_uuid, device)
                        return fab.run(command).succeeded
        except:
            return False
Esempio n. 4
0
    def list_mounts(self, hostname):
        mount_file = '/proc/mounts'
        remote_cmd = "cat " + mount_file
        mount_list = {}

        returncode, output, errmsg = self._remote_cmd(hostname, remote_cmd)

        if returncode == 0:

            for mount in output.split('\r\n'):
                mount = mount.split(' ')

                mount_device = mount[0]
                mount_path = mount[1]
                mount_list[mount_path] = mount_device

        else:
            print "[ERROR]: Failed to retrieve list of mounts on " + hostname + " due to: ", errmsg

        return mount_list
Esempio n. 5
0
    def list_files(self, hostname, path):

        file_list = {}

        if path is not '':
            remote_cmd = "find -H " + path + " -type f -exec du -sm {} \;"
            returncode, output, errmsg = self._remote_cmd(hostname, remote_cmd)

            if returncode == 0:

                for line in output.split('\r\n'):
                    line = line.split('\t')

                    file_size = line[0]
                    file_path = line[1]

                    file_list[file_path] = file_size

            else:
                print "[ERROR]: Failed to retrieve list from " + hostname + "of file due to: ", output, errmsg

        return file_list