gtk has asked for the wisdom of the Perl Monks concerning the following question:

Hi Perlmonks, I am looking for a method to verify an environment for the changes done in current enviornment before deploying a new release? This is included with both applictaion server and database server. It's really a like pre-verificational step in a release deployment. Thanks.

  • Comment on Method to verify an environment with changes

Replies are listed 'Best First'.
Re: Method to verify an environment with changes
by thanos1983 (Parson) on Jul 31, 2017 at 10:04 UTC

    Hello gtk,

    I am kind of lost with your question, can you provide us a bit more details of what do you mean and what approaches you have tried so far and it did not worked for you?

    Looking forward for your reply, BR.

    Seeking for Perl wisdom...on the process of learning...not there...yet!

      Hi Thanos, Sorry for the inconvinience caused. Actually I am writing a perl script to verify/track the changes done in a production environment. This is must since there can be issues after deploying the new release in production enviornmnet. So I needed to check whether the existing files (.xml, .ini, etc) are modified or not? So I used use File::Find module to traversed the direcctories and get the checksums of each file and stored in a temporaray file to get the diff before and after deploying the release. Are there any other methods/initiatives for this? At the same time, At the same time, in DB (oracle) side, I need to figure it out whether the tables have been updated or not? So I am planning to use oracle audit feature for this. Please do let me know whther this is possible or any other method can be done by Perl.Hope this will clarify you. Thanks.

        For files and directories, use a version control system. I'd use git, for which CPAN modules are available. You can check the cleanness of an entire repository with a single command. For a database, I'd probably record and verify transaction IDs.

        perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

        Hello gtk

        I would followed the same way as the fellow monk shmem has already proposed, with a bit of twist.

        I would use File::Find::Rule and stat in combination with git CPAN modules. Why to use all of these modules? Simple, I would check all the files in all the directories that I would like to observe. As a second step I would check when was the last updated date and based on a condition e.g. if they have changed since a specific date then check with the assistance of git what has changed and by whom? Job done ;)

        Sample of code with half of the solution:

        #!/usr/bin/perl use strict; use warnings; use File::stat; use Data::Dumper; use Time::localtime; use File::Find::Rule; sub get_files { my @dirs = ('/home/user/Monks' , '/home/user/Monks/mySubDir'); # a +dd more my $level = shift // 2; # level to dig into my @files = File::Find::Rule->file() ->name('*.xml', '*.txt') # add your file(s) extension(s) ->maxdepth($level) ->in(@dirs); return @files; } my @files = get_files(); my %hash; for (@files) { $hash{$_} = ctime(stat($_)->mtime); } # or # for (@files) { $hash{ctime(stat($_)->mtime)} = $_; } print Dumper \%hash; __END__ $ perl test.pl $VAR1 = { '/home/user/Monks/ArabicCharacters/original.txt' => 'Fri Jul + 28 13:21:04 2017', '/home/user/Monks/out.txt' => 'Thu Jul 20 13:29:41 2017', '/home/user/Monks/filter.txt' => 'Thu Jul 13 11:03:53 2017', . . . };

        If you do not know what git is, or if you have never use it before read this git - the simple guide.

        Hope this helps, BR.

        Seeking for Perl wisdom...on the process of learning...not there...yet!