hesco@marcus8:~/sandbox$ grep `whoami` /etc/passwd
hesco:x:1000:1000:Hugh Esco,,,:/home/hesco:/bin/bash
hesco@marcus8:~/sandbox$ ls -al t/
total 61
drwxr-xr-x 6 hesco hesco 736 2012-01-22 14:38 .
drwxr-xr-x 11 hesco hesco 856 2011-12-24 21:29 ..
hesco@marcus8:~/sandbox$ ls -al t/conf/
total 13
drwxr-xr-x 6 hesco hesco 280 2012-01-22 13:50 .
drwxr-xr-x 6 hesco hesco 736 2012-01-22 14:38 ..
hesco@marcus8:~/sandbox$ ls -al t/conf/etc/
total 0
drwxr-xr-x 3 hesco hesco 72 2011-07-02 00:57 .
drwxr-xr-x 6 hesco hesco 280 2012-01-22 13:50 ..
hesco@marcus8:~/sandbox$ ls -al t/conf/etc/apache2/
total 1
drwxr-xr-x 3 hesco hesco 80 2011-07-02 00:57 .
drwxr-xr-x 3 hesco hesco 72 2011-07-02 00:57 ..
hesco@marcus8:~/sandbox$ ls -al t/conf/etc/apache2/sites-available/
total 18
drwxr-xr-x 11 hesco hesco 480 2012-01-22 13:50 .
drwxr-xr-x 3 hesco hesco 80 2011-07-02 00:57 ..
hesco@marcus8:~/sandbox$ ls -al t/conf/etc/apache2/sites-available/test_suite/
total 1
drwxr-xr-x 2 hesco hesco 48 2012-01-22 13:51 .
drwxr-xr-x 11 hesco hesco 480 2012-01-22 13:50 ..
####
hesco@marcus8:~/sandbox$ perl t/14-ymd_provision_apache.t
snip
Use of uninitialized value $parent_directory in substitution (s///) at lib/Apache.pm line 139.
Use of uninitialized value $parent_directory in concatenation (.) or string at lib/Apache.pm line 140.
We hope we can write to: at lib/Apache.pm line 140.
Use of uninitialized value $parent_directory in -w at lib/Apache.pm line 141.
not ok 33 - We got an anticipated result for our new apache vhost path.
# Failed test 'We got an anticipated result for our new apache vhost path.'
# at t/14-ymd_provision_apache.t line 64.
# got: 'ERROR: user - 1000 is unable to create t/conf/etc/apache2/sites-available/test_suite/test.example.org'
# expected: 't/conf/etc/apache2/sites-available/test_suite/test.example.org'
# File [ERROR: user - 1000 is unable to create t/conf/etc/apache2/sites-available/test_suite/test.example.org] does not exist
##
##
my $new_vhost_path = "$apache_vhost_base_path/" . $site->{'vhost_server_name'};
if( -e $new_vhost_path ){
return 'ERROR: will not overwrite an existing configuration file:' . $new_vhost_path;
} else {
my $parent_directory = $new_vhost_path =~ s,^(.*)/(.*),$1,;
warn "We hope we can write to: $parent_directory ";
if( -w $parent_directory ){
warn "We apparently believe that we can write to: $parent_directory \n";
$self->{'apache'}->save( $new_vhost_path, '-reformat' );
return $new_vhost_path;
} else {
return 'ERROR: user - ' . $> . ' is unable to create ' . $new_vhost_path;
}
}
}
##
##
- my $parent_directory = $new_vhost_path =~ s,^(.*)/(.*),$1,;
+ my $parent_directory = $new_vhost_path;
+ $parent_directory =~ s,^(.*)/.*$,$1,;
warn "We hope we can write to: $parent_directory ";