← Back to team overview

mvhub-dev team mailing list archive

[Merge] lp:~reddy22222/mvhub/session_temp_dir3 into lp:mvhub

 

Srihari Reddy has proposed merging lp:~reddy22222/mvhub/session_temp_dir3 into lp:mvhub.

Requested reviews:
  MVHub devs with commit rights (mvhub-commit)


fixed 'session files to go in site specfic temp dir' bug

has 1 test failure:
#   Failed test 'pdf as old or older than doc cheatsheet'
#   at app-mvhub/t/cheat_sheet_pdf_updated.t line 32.
# need to regenerate /var/www/mvhub/reddy22222/link-to-live-code/app-mvhub/DocumentRoot/static/mvh/html/preparing_for_directory_submission.pdf from /var/www/mvhub/reddy22222/link-to-live-code/app-mvhub/DocumentRoot/static/mvh/html/preparing_for_directory_submission.doc
# Looks like you failed 1 test of 2.
app-mvhub/t/cheat_sheet_pdf_updated.t ......................... 
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/2 subtests 

-- 
https://code.launchpad.net/~reddy22222/mvhub/session_temp_dir3/+merge/28088
Your team MVHub Developers is subscribed to branch lp:mvhub.
=== modified file 'app-mvhub/project-tools/bin/mv_update_staging'
--- app-mvhub/project-tools/bin/mv_update_staging	2010-05-28 18:56:18 +0000
+++ app-mvhub/project-tools/bin/mv_update_staging	2010-06-21 18:09:27 +0000
@@ -71,7 +71,7 @@
 	
 	$prompt = "Reload databases with recent production data? (Y/N):";
     if ( !($interactive) || IO::Prompt::prompt( $prompt, -YN ) ) {
-    	MVHub::Utils::Setup::get_production_data( @WEBSITE_CODES ); 
+    	MVHub::Utils::Setup::get_production_data( $cfg, @WEBSITE_CODES ); 
         MVHub::Utils::Setup::make_databases_for( $USERNAME, $cfg, @WEBSITE_CODES );
     	MVHub::Utils::Setup::load_production_data( $USERNAME, $cfg, @WEBSITE_CODES );
 	}

=== modified file 'lib-mvhub/lib/MVHub/AuthAccount.pm'
--- lib-mvhub/lib/MVHub/AuthAccount.pm	2010-05-14 17:05:42 +0000
+++ lib-mvhub/lib/MVHub/AuthAccount.pm	2010-06-21 18:09:27 +0000
@@ -12,10 +12,11 @@
 # TODO: Look into pre-written authentication/authorization
 # framework rather than rolling our own.
 
-my $cfg
+my $CFG
     = MVHub::Utils::ConfigSimple::create_config_from( $ENV{MV_CONFIG_FILE} );
-my $AUTH_COOKIE_NAME = $cfg->param('COOKIES.auth_cookie_name');
-my $ADMIN_ID         = $cfg->param('CONSTANTS.admin_id');
+my $TMP_DIR          = $CFG->param('ABSOLUTE_PATH.tmp_dir');
+my $AUTH_COOKIE_NAME = $CFG->param('COOKIES.auth_cookie_name');
+my $ADMIN_ID         = $CFG->param('CONSTANTS.admin_id');
 our @EXPORT_OK = qw(
     authenticate_session
     init_session
@@ -152,7 +153,7 @@
 
     # TODO put location of sessions dir in config file
     my $session = new CGI::Session( "driver:File", $session_id,
-        { Directory => '/tmp' } );
+        { Directory => "$TMP_DIR" } );
 
     # It would appear that the only way to know that a session id was
     # invalid is to create a session object using it (as we did

=== modified file 'lib-mvhub/lib/MVHub/CGIAppBase.pm'
--- lib-mvhub/lib/MVHub/CGIAppBase.pm	2010-06-10 18:14:35 +0000
+++ lib-mvhub/lib/MVHub/CGIAppBase.pm	2010-06-21 18:09:27 +0000
@@ -69,6 +69,7 @@
     $self->header_add( -Cache_Control => 'no-store' );
 
     my $cookie_name = $self->get_config_param('COOKIES.auth_cookie_name');
+    my $tmp_dir     = $self->get_config_param('ABSOLUTE_PATH.tmp_dir');
 
     my $session_id = $cgi->cookie($cookie_name);
 
@@ -77,7 +78,7 @@
     # TODO put Directory in config file [PATH].session_dir
     my $session
         = new CGI::Session( "driver:File", $session_id,
-        { Directory => '/tmp/' } )
+        { Directory => "$tmp_dir/" } )
         or croak CGI::Session->erstr();
 
     if ( !defined $session_id || $session_id ne $session->id() ) {

=== modified file 'lib-mvhub/lib/MVHub/Utils/Setup.pm'
--- lib-mvhub/lib/MVHub/Utils/Setup.pm	2010-06-13 23:15:16 +0000
+++ lib-mvhub/lib/MVHub/Utils/Setup.pm	2010-06-21 18:09:27 +0000
@@ -12,6 +12,7 @@
 use File::Copy;
 
 use MVHub::Utils::DB;
+use MVHub::Utils::ConfigSimple;
 
 our @EXPORT_OK = qw(
 
@@ -479,9 +480,12 @@
 }
 
 sub get_production_data {
+    my $cfg           = shift;
     my @website_codes = @_;
     my $cmd;
 
+    my $tmp_dir = $cfg->param('ABSOLUTE_PATH.tmp_dir');
+
     my $dt        = DateTime->now()->subtract( days => 1 );
     my $ymd       = $dt->ymd;
     my $dow       = $dt->day_abbr;
@@ -491,7 +495,7 @@
     foreach my $site_code (@website_codes) {
         $cmd = "rsync csl-db-02.inside::backup/postgres/";
         $cmd .= "${timestamp}_${site_code}_production_db.dump ";
-        $cmd .= "/tmp/${site_code}_production_data.dump";
+        $cmd .= "$tmp_dir/${site_code}_production_data.dump";
 
         ( system($cmd) == 0 )
             or die
@@ -506,6 +510,7 @@
     my @website_codes = @_;
 
     my $cmd;
+    my $tmp_dir = $cfg->param('ABSOLUTE_PATH.tmp_dir');
 
     print "Loading production data...";
     foreach my $suffix (@website_codes) {
@@ -518,7 +523,7 @@
         _set_db_ENV_vars($user_cfg);
 
         $cmd
-            = "pg_restore -O -x -d $username.$suffix /tmp/${suffix}_production_data.dump >/dev/null";
+            = "pg_restore -O -x -d $username.$suffix ${tmp_dir}/${suffix}_production_data.dump >/dev/null";
 
         ( system($cmd) == 0 )
             or warn "failed to load ${suffix}_production_data.dump";


Follow ups