Changeset 55c074c


Ignore:
Timestamp:
Jul 21, 2009 2:44:49 PM (15 years ago)
Author:
Ted Faber <faber@…>
Branches:
axis_example, compt_changes, info-ops, master, version-1.30, version-2.00, version-3.01, version-3.02
Children:
2c9fff0
Parents:
866c983
Message:

untested scripting of fs mods

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedd/federation/experiment_control.py

    r866c983 r55c074c  
    602602        if not self.scp_file("%s/%s/%s" % (tmpdir, tb, tclfile), user, host):
    603603            return False
    604         # Clear the federation config dirs
    605         if not self.ssh_cmd(user, host,
    606                 "/bin/sh -c \"'/bin/rm -rf %s'\"" % proj_dir):
    607             return False
    608         # Clear and create the tarfiles and rpm directories
    609         for d in (tarfiles_dir, rpms_dir):
    610             if not self.ssh_cmd(user, host,
    611                     "/bin/sh -c \"'/bin/rm -rf %s/*'\"" % d):
    612                 return False
    613             if not self.ssh_cmd(user, host, "mkdir -p %s" % d,
    614                     "create tarfiles"):
    615                 return False
    616604       
    617605        if state == 'none':
     
    627615                return False
    628616       
    629         # Create the federation config dirs
    630         if not self.ssh_cmd(user, host,
    631                 "/bin/sh -c \"'mkdir -p %s'\"" % proj_dir):
     617        # Open up a temporary file to contain a script for setting up the
     618        # filespace for the new experiment.
     619        self.log.info("[start_segment]: creating script file")
     620        try:
     621            sf, scriptname = tempfile.mkstemp()
     622            scriptfile = os.fdopen(df, 'w')
     623        except IOError:
    632624            return False
     625
     626        # Script the filesystem changes
     627        print >>scriptfile, "/bin/sh -c \"'/bin/rm -rf %s'\"" % proj_dir
     628        # Clear and create the tarfiles and rpm directories
     629        for d in (tarfiles_dir, rpms_dir):
     630            print >>scriptfile, "/bin/sh -c \"'/bin/rm -rf %s/*'\"" % d
     631            print >>scriptfile, "mkdir -p %s" % d
     632        print >>scriptfile, "/bin/sh -c \"'mkdir -p %s'\"" % proj_dir
     633        print >>scriptfile, "rm %s" % scriptfile
     634        close(scriptdir)
     635
     636        # Move the script to the remote machine
     637        # XXX: could collide tempfile names on the remote host
     638        if self.scp_file(scriptname, user, host, scriptname):
     639            os.remove(scriptname)
     640        else:
     641            return False
     642
     643        # Execute the script (and the script's last line deletes it)
     644        if not self.ssh_cmd(user, host, "sh -x %s" % scriptname):
     645            return False
     646
    633647        for f in base_confs:
    634648            if not self.scp_file("%s/%s" % (tmpdir, f), user, host,
Note: See TracChangeset for help on using the changeset viewer.