teardown_forms.list 3.2 KB
Newer Older
1
# Gotta do this stuff with admin privs.
2 3 4 5
! gmake admin

!expidx=sql "select idx from experiments where pid='testproj3' and eid='testexp3'"
! if ( "$expidx" != "" ) then
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    # Deal with an experiment "stuck in transition".
    !expstate=sql "select state from experiments where pid='testproj3' and eid='testexp3'"
    ! if ( "$expstate" == "terminating" ) then
	!sql "update experiments set state="active" where pid='testproj3' and eid='testexp3'"
    ! endif
    !explocked=sql "select expt_locked from experiments"
    ! if ( "$explocked" == "1" ) then
	!sql "update experiments set expt_locked=NULL where pid='testproj3' and eid='testexp3'"
    ! endif

    # We want to get here with testexp3 swapped out.
    ! if ( "$expstate" == "swapping" ) then
	! ssh $MYBOSS ./waitexp testproj3 testexp3 swapped
    ! endif

22 23 24 25 26
    ! if ( "$expstate" != "swapped" ) then
	/swapexp.php3
	# Wait for the swapout to finish if a probe gets through.
	-ssh $MYBOSS  ./waitexp testproj3 testexp3 swapped
    ! endif
27 28 29 30 31 32 33 34

    # Don't go on until it's actually swapped out.
    ! ssh $MYBOSS ./waitexp testproj3 testexp3 swapped

    # Now kill the experiment.
    /endexp.php3
    - $SRCDIR/undo-probe.pl -t -p testproj3 exp testexp3

35 36 37 38
! else
!     echo "*** No experiment testproj3/testexp3! ***"
! endif

39
/freenode.php3
Russ Fish's avatar
Russ Fish committed
40 41 42

!imgidx=sql "select imageid from images where pid='testproj3' and imagename='testimg3'"
! if ( "$imgidx" != "" ) then
43
    /deleteimageid.php3
Russ Fish's avatar
Russ Fish committed
44 45 46 47 48 49
! else
!     echo "*** No image testimg3! ***"
! endif

!imgidx=sql "select imageid from images where pid='testproj3' and imagename='testimg3a'"
! if ( "$imgidx" != "" ) then
50
    /deleteimageid.php3
Russ Fish's avatar
Russ Fish committed
51 52 53 54 55 56
! else
!     echo "*** No image testimg3a! ***"
! endif

!osidx=sql "select osid from os_info where pid='testproj3' and osname='testosid3'"
! if ( "$osidx" != "" ) then
57
    /deleteosid.php3
Russ Fish's avatar
Russ Fish committed
58 59 60
! else
!     echo "*** No os id testosid3! ***"
! endif
61 62 63

!usridx=sql "select uid_idx from users where uid='testusr3'"
! if ( "$usridx" != "" ) then
64 65 66 67 68 69

    /deletepubkey.php3
    ###/deletesfskey.php3
    /freezeuser.php3
    /deleteuser.php3

70 71 72
! else
!     echo "*** No user testusr3! ***"
! endif
73 74
# Allow creating testusr3 again in setup.
!sql "delete from deleted_users where uid='testusr3'"
75
!sql "delete from users where uid='testusr3' and status='archived'"
76 77 78

!grpidx=sql "select gid_idx from groups where gid='testgroup3'"
! if ( "$grpidx" != "" ) then
79
    /deletegroup.php3
80 81 82 83
! else
!     echo "*** No group testgroup3! ***"
! endif

Russ Fish's avatar
Russ Fish committed
84 85 86
# Place-holder...
/delmmlist.php3

87 88
!projidx=sql "select pid_idx from projects where pid='testproj3'"
! if ( "$projidx" != "" ) then
89 90 91 92 93

    # Currently, once a template has been created, a project can never be deleted.
    !sql "delete from experiments where pid = 'testproj3' and eid like'T%-%'"
    /deleteproject.php3

94 95 96 97
! else
!     echo "*** No project testproj3! ***"
! endif

98 99
# No other way to delete xref_tags?
!sql "delete from knowledge_base_entries where xref_tag like'test_tag%'"
100 101 102

# Users don't actually get deleted anymore, they get archived.  Clean up.
!sql "delete from users where uid='testusr3'"
Russ Fish's avatar
Russ Fish committed
103 104
!sql "delete from group_membership where uid='testusr3'"

105 106 107 108
# Remove the user w.r.t. getpwnam as well.
! ssh $MYBOSS sudo pw userdel -n testusr3
# Clear the error return if it fails, for gmake.
! echo Done.