DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦50e777e96⟧ Ada Source

    Length: 16384 (0x4000)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, procedure Verify_Installation, seg_005d73

Derivation

└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
    └─ ⟦5a81ac88f⟧ »Space Info Vol 1« 
        └─⟦this⟧ 

E3 Source Code



with Debug_Tools;
with Directory_Tools;
with File_Utilities;
with Log;
with Profile;
with Remote_Operations;
with Simple_Status;
procedure Verify_Installation (On_Host  : String;
                               Username : String := "root";
                               Password : String;
                               Response : String := "~---,<VERBOSE>") is

    package Dtn renames Directory_Tools.Naming;
    package Fu  renames File_Utilities;
    package Ro  renames Remote_Operations;
    package Ss  renames Simple_Status;

    procedure Error (Message  : String;
                     Kind     : Profile.Msg_Kind         := Profile.Error_Msg;
                     Response : Profile.Response_Profile := Profile.Get)
        renames Log.Put_Line;
    procedure Note (Message  : String;
                    Kind     : Profile.Msg_Kind         := Profile.Note_Msg;
                    Response : Profile.Response_Profile := Profile.Get)
        renames Log.Put_Line;
    procedure Positive (Message  : String;
                        Kind     : Profile.Msg_Kind := Profile.Positive_Msg;
                        Response : Profile.Response_Profile := Profile.Get)
        renames Log.Put_Line;

    Original_Response : constant Profile.Response_Profile := Profile.Get;

    Context : Ro.Context;
    Status  : Ro.Error_Status;

    Default_Context  : constant Ro.Rational_Pathname :=
       Dtn.Full_Name (Dtn.Default_Context & '$');
    Remote_Test_Area : constant Ro.Remote_Pathname   :=  
       "/tmp/Dtia_Test_Area";

    Local_Object                : constant Ro.Rational_Pathname :=
       Default_Context & ".VERIFY_INSTALLATION'BODY";
    Local_Copy_Of_Remote_Object : constant Ro.Rational_Pathname :=
       Default_Context & ".LOCAL_COPY_OF_REMOTE_OBJECT";

    Remote_Object : constant Ro.Remote_Pathname :=
       Remote_Test_Area & "/install";

    Copied_Object_Simple_Name : constant Ro.Remote_Pathname := "install.copied";

    Copied_Object : constant Ro.Remote_Pathname :=
       Remote_Test_Area & '/' & Copied_Object_Simple_Name;

    Moved_Object : constant Ro.Remote_Pathname :=
       Remote_Test_Area & "/install.moved";

    Remote_Command : constant String := "/bin/ls " & Remote_Test_Area;

    procedure Check (Status : Ro.Error_Status) is
    begin
        if Ss.Error (Status) then
            Log.Put_Condition (Status);
            raise Profile.Error;
        end if;
    end Check;

    procedure Acquire_Connection is
    begin
        Note ("Acquiring connection to host """ &
              On_Host & """ as user """ & Username & '"');
        Ro.Acquire (A_Context => Context,
                    Status    => Status,
                    Machine   => On_Host,
                    User      => Username,
                    Password  => Password,
                    Session   => "");
        Check (Status);
    end Acquire_Connection;

    procedure Create_Test_Area is
        Test_Area_Exists : Boolean;
    begin
        Note ("Checking for test area existence on remote machine");
        Ro.File_Exists (The_File   => Remote_Test_Area,
                        In_Context => Context,
                        Status     => Status,
                        Exists     => Test_Area_Exists);
        Check (Status);
        if Test_Area_Exists then
            Note ("Destroying old test area");
            Ro.Delete_Directory (In_Context => Context,
                                 With_Name  => Remote_Test_Area,
                                 Status     => Status,
                                 Recursive  => True);
            Check (Status);
        end if;
        Note ("Creating new test area " & Remote_Test_Area);
        Ro.Create_Directory (In_Context => Context,  
                             With_Name  => Remote_Test_Area,
                             Status     => Status);
        Check (Status);
    end Create_Test_Area;

    procedure File_Transfer is
    begin
        Note ("Storing " & Local_Object & " into " & Remote_Object);
        Ro.Put (From_File  => Local_Object,
                To_File    => Remote_Object,
                In_Context => Context,
                Status     => Status);
        Check (Status);
        Note ("Retrieving " & Remote_Object &
              " into " & Local_Copy_Of_Remote_Object);
        Ro.Get (From_File  => Remote_Object,
                In_Context => Context,
                To_File    => Local_Copy_Of_Remote_Object,
                Status     => Status);
        Check (Status);
        if Fu.Equal (Local_Object, Local_Copy_Of_Remote_Object) then
            Positive ("File transfer was successful");
        else
            Error ("Errors were detected during file transfer");
            raise Profile.Error;
        end if;
    end File_Transfer;

    procedure Remote_Copy is
        Copied_Object_Exists : Boolean;
    begin
        Note ("Copying " & Remote_Object & " to " & Copied_Object);
        Ro.Copy (From_File  => Remote_Object,
                 To_File    => Copied_Object,
                 In_Context => Context,
                 Status     => Status);
        Check (Status);
        Ro.File_Exists (The_File   => Copied_Object,
                        In_Context => Context,
                        Status     => Status,
                        Exists     => Copied_Object_Exists);
        Check (Status);
        if Copied_Object_Exists then
            Positive ("Remote copy succeeded");
        else
            Error ("Remote copy failed");
            raise Profile.Error;
        end if;
    end Remote_Copy;

    procedure Remote_Move is
        Moved_Object_Exists : Boolean;
    begin
        Note ("Moving " & Remote_Object & " to " & Moved_Object);
        Ro.Move (From_File  => Remote_Object,
                 To_File    => Moved_Object,
                 In_Context => Context,
                 Status     => Status);
        Check (Status);
        Ro.File_Exists (The_File   => Moved_Object,
                        In_Context => Context,
                        Status     => Status,
                        Exists     => Moved_Object_Exists);
        Check (Status);
        if Moved_Object_Exists then
            Positive ("Remote move succeeded");
        else
            Error ("Remote move failed");
            raise Profile.Error;
        end if;
    end Remote_Move;

    procedure Remote_Delete is
        Deleted_Object_Exists : Boolean;
    begin
        Note ("Deleting " & Moved_Object);
        Ro.Delete_File (In_Context => Context,
                        With_Name  => Moved_Object,
                        Status     => Status);
        Check (Status);
        Ro.File_Exists (The_File   => Moved_Object,
                        In_Context => Context,
                        Status     => Status,
                        Exists     => Deleted_Object_Exists);
        Check (Status);
        if Deleted_Object_Exists then
            Error ("Remote delete failed");
            raise Profile.Error;
        else
            Positive ("Remote delete succeeded");
        end if;
    end Remote_Delete;

    procedure Remote_Execution is
        Command_Was_Successful : Boolean := False;
        procedure Process_Output (Text     :        String;
                                  Severity :        Profile.Msg_Kind;
                                  State    : in out Boolean;
                                  Response : in out Ro.Command_Response) is
        begin
            Note ("Verifying command output");
            State := Text = Copied_Object_Simple_Name & Ascii.Lf;
            if not State then
                Error ("Unexpected command output {" &
                       Text & "} during command execution");
            end if;
        end Process_Output;
        procedure Read_Input (State    : in out Boolean;
                              Buffer   : out    String;
                              Last     : out    Natural;
                              Response : in out Ro.Command_Response) is
        begin
            State    := False;
            Buffer   := (others => Ascii.Nul);
            Last     := 0;
            Response := Ro.Abort_Command;
            Error ("Unexpected attempt to read input during command execution");
        end Read_Input;
        procedure Timeout_Handler (State    : in out Boolean;
                                   Response : in out Ro.Command_Response) is
        begin
            State    := False;
            Response := Ro.Abort_Command;
            Error ("Unexpected timeout during command execution");
        end Timeout_Handler;
        procedure Perform_Execution is
           new Ro.Execution_Generic (Execution_State => Boolean,
                                     Process_Output  => Process_Output,
                                     Read_Input      => Read_Input,
                                     Timeout_Handler => Timeout_Handler);
    begin
        Note ("Executing " & Remote_Command);
        Perform_Execution (Command    => Remote_Command,
                           In_Context => Context,
                           State      => Command_Was_Successful,
                           Status     => Status);
        Check (Status);
        if Command_Was_Successful then
            Positive ("Remote command execution succeeded");
        else
            Error ("Remote command execution failed");
            raise Profile.Error;
        end if;
    end Remote_Execution;

    procedure Remote_Cleanup is
    begin
        Note ("Deleting directory " & Remote_Test_Area);
        Ro.Delete_Directory (In_Context => Context,
                             With_Name  => Remote_Test_Area,
                             Status     => Status,
                             Recursive  => True);
        Check (Status);
    end Remote_Cleanup;

    procedure Destroy_Connection is
    begin
        Ro.Destroy (A_Context => Context, Status => Status);
        Check (Status);
    end Destroy_Connection;

begin

    Profile.Set (Profile.Value (Response));

    Acquire_Connection;
    Create_Test_Area;
    File_Transfer;
    Remote_Copy;
    Remote_Move;
    Remote_Delete;
    Remote_Execution;
    Remote_Cleanup;
    Destroy_Connection;

    Positive ("Verify_Installation has completed successfully");
    Profile.Set (Original_Response);

exception
    when Profile.Error =>
        Error ("Verify_Installation has failed with errors");
        Profile.Set (Original_Response);

    when others =>
        Log.Put_Line ("Verify_Installation failed with" &
                      " an unhandled exception " &
                      Debug_Tools.Get_Exception_Name, Profile.Exception_Msg);
        Error ("Verify_Installation has failed with errors");
        Profile.Set (Original_Response);
end Verify_Installation;

E3 Meta Data

    nblk1=f
    nid=0
    hdr6=1e
        [0x00] rec0=1a rec1=00 rec2=01 rec3=02c
        [0x01] rec0=00 rec1=00 rec2=0f rec3=006
        [0x02] rec0=18 rec1=00 rec2=02 rec3=092
        [0x03] rec0=02 rec1=00 rec2=0e rec3=00c
        [0x04] rec0=1d rec1=00 rec2=03 rec3=03e
        [0x05] rec0=16 rec1=00 rec2=04 rec3=026
        [0x06] rec0=1b rec1=00 rec2=05 rec3=006
        [0x07] rec0=1a rec1=00 rec2=06 rec3=022
        [0x08] rec0=1a rec1=00 rec2=07 rec3=05a
        [0x09] rec0=18 rec1=00 rec2=08 rec3=02c
        [0x0a] rec0=15 rec1=00 rec2=09 rec3=046
        [0x0b] rec0=00 rec1=00 rec2=0d rec3=018
        [0x0c] rec0=17 rec1=00 rec2=0a rec3=05c
        [0x0d] rec0=24 rec1=00 rec2=0b rec3=092
        [0x0e] rec0=04 rec1=00 rec2=0c rec3=000
    tail 0x21500f60081b86938f6ca 0x42a00088462069e03