Skip to content

Commit

Permalink
Merge pull request #6 from cpanel/RE-937
Browse files Browse the repository at this point in the history
Fix race condition that can occur between ssh_retry and reboot_watch
  • Loading branch information
davelcpanelnet authored Nov 4, 2024
2 parents be0b30c + c97d891 commit aff273e
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 27 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/openstack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ jobs:
- name: Checkout Repo and Commit
if: github.event_name != 'pull_request'
uses: appleboy/ssh-action@v1.0.3
uses: appleboy/ssh-action@v1.1.0
with:
host: ${{ steps.VM_IP.outputs.VM_IP }}
username: 'root'
Expand All @@ -129,7 +129,7 @@ jobs:
- name: Checking out Repo and Pull Request
if: github.event_name == 'pull_request'
uses: appleboy/ssh-action@v1.0.3
uses: appleboy/ssh-action@v1.1.0
with:
host: ${{ steps.VM_IP.outputs.VM_IP }}
username: 'root'
Expand Down Expand Up @@ -168,7 +168,7 @@ jobs:
run: echo "VM_IP is ${{ steps.VM_IP.outputs.VM_IP }}"

- name: Setup for Integration Checks Prior to Running Elevate
uses: appleboy/ssh-action@v1.0.3
uses: appleboy/ssh-action@v1.1.0
with:
host: ${{ steps.VM_IP.outputs.VM_IP }}
username: 'root'
Expand Down Expand Up @@ -203,7 +203,7 @@ jobs:
run: echo "VM_IP is ${{ steps.VM_IP.outputs.VM_IP }}"

- name: Starting Elevate
uses: appleboy/ssh-action@v1.0.3
uses: appleboy/ssh-action@v1.1.0
with:
host: ${{ steps.VM_IP.outputs.VM_IP }}
username: 'root'
Expand Down Expand Up @@ -270,7 +270,7 @@ jobs:
VM_IP: ${{ steps.VM_IP.outputs.VM_IP }}
run: echo "VM_IP is ${{ steps.VM_IP.outputs.VM_IP }}"
- name: Monitor Elevate for Reboot from Stage 1 into Stage 2
uses: appleboy/ssh-action@v1.0.3
uses: appleboy/ssh-action@v1.1.0
with:
host: ${{ steps.VM_IP.outputs.VM_IP }}
username: 'root'
Expand Down Expand Up @@ -335,7 +335,7 @@ jobs:
VM_IP: ${{ steps.VM_IP.outputs.VM_IP }}
run: echo "VM_IP is ${{ steps.VM_IP.outputs.VM_IP }}"
- name: Monitor Elevate for Stage 3 Reboot
uses: appleboy/ssh-action@v1.0.3
uses: appleboy/ssh-action@v1.1.0
with:
host: ${{ steps.VM_IP.outputs.VM_IP }}
username: 'root'
Expand Down Expand Up @@ -400,7 +400,7 @@ jobs:
VM_IP: ${{ steps.VM_IP.outputs.VM_IP }}
run: echo "VM_IP is ${{ steps.VM_IP.outputs.VM_IP }}"
- name: Monitor Elevate for Stage 4 Reboot
uses: appleboy/ssh-action@v1.0.3
uses: appleboy/ssh-action@v1.1.0
with:
host: ${{ steps.VM_IP.outputs.VM_IP }}
username: 'root'
Expand Down Expand Up @@ -464,7 +464,7 @@ jobs:
VM_IP: ${{ steps.VM_IP.outputs.VM_IP }}
run: echo "VM_IP is ${{ steps.VM_IP.outputs.VM_IP }}"
- name: Monitor Elevate for Stage 5 Reboot
uses: appleboy/ssh-action@v1.0.3
uses: appleboy/ssh-action@v1.1.0
with:
host: ${{ steps.VM_IP.outputs.VM_IP }}
username: 'root'
Expand Down Expand Up @@ -528,7 +528,7 @@ jobs:
VM_IP: ${{ steps.VM_IP.outputs.VM_IP }}
run: echo "VM_IP is ${{ steps.VM_IP.outputs.VM_IP }}"
- name: Monitor Elevate for Final Reboot
uses: appleboy/ssh-action@v1.0.3
uses: appleboy/ssh-action@v1.1.0
with:
host: ${{ steps.VM_IP.outputs.VM_IP }}
username: 'root'
Expand Down Expand Up @@ -592,7 +592,7 @@ jobs:
VM_IP: ${{ steps.VM_IP.outputs.VM_IP }}
run: echo "VM_IP is ${{ steps.VM_IP.outputs.VM_IP }}"
- name: Verify End Result Integration Tests
uses: appleboy/ssh-action@v1.0.3
uses: appleboy/ssh-action@v1.1.0
with:
host: ${{ steps.VM_IP.outputs.VM_IP }}
username: 'root'
Expand All @@ -617,4 +617,4 @@ jobs:
name: ${{ github.run_id }}-tf.out.json
path: ${{ github.workspace }}/tf.out.json
- name: Destroy OpenStack VM
run: terraform destroy -no-color -auto-approve
run: terraform destroy -no-color -auto-approve
4 changes: 2 additions & 2 deletions .github/workflows/openstack/ssh_retry
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ my $HOST = $ARGV[0];
my $PORT = $ARGV[1] // 22;
my $RETVAL = 1;
my $RETRIES = 0;
my $RETRY = $ARGV[2] // 240;
my $RETRY = $ARGV[2] // 900;

return unless defined $HOST;

Expand All @@ -32,5 +32,5 @@ while ( $RETVAL != 0 ) {
print "## [$time] [ERROR]: ssh_retry.pl: MAX_RETRIES has been reached.\n";
exit 1;
}
sleep 5;
sleep 1;
}
17 changes: 10 additions & 7 deletions elevate-cpanel
Original file line number Diff line number Diff line change
Expand Up @@ -6717,8 +6717,8 @@ EOS
return instance()->update_with_options( $options, $pkgs );
}

sub update_allow_erasing (@args) {
return instance()->update_allow_erasing(@args);
sub update_allow_erasing (@additional_args) {
return instance()->update_allow_erasing(@additional_args);
}

sub makecache () {
Expand Down Expand Up @@ -6893,7 +6893,7 @@ EOS
die "update_with_options unimplemented";
}

sub update_allow_erasing ( $self, @args ) {
sub update_allow_erasing ( $self, @additional_args ) {
die "update_allow_erasing unimplemented";
}

Expand Down Expand Up @@ -7153,13 +7153,16 @@ EOS
return;
}

sub update_allow_erasing ( $self, @args ) {
sub update_allow_erasing ( $self, @additional_args ) {
my $pkgmgr = $self->_pkgmgr();

my @additional_args = scalar @args ? @args : '';

$self->ssystem( $pkgmgr, '-y', '--allowerasing', @additional_args, 'update' );
my @args = (
'-y',
'--allowerasing',
);

push @args, @additional_args;
$self->ssystem_and_die( $pkgmgr, @args, 'update' );
return;
}

Expand Down
4 changes: 2 additions & 2 deletions lib/Elevate/PkgMgr.pm
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ sub update_with_options ( $options, $pkgs ) {
return instance()->update_with_options( $options, $pkgs );
}

sub update_allow_erasing (@args) {
return instance()->update_allow_erasing(@args);
sub update_allow_erasing (@additional_args) {
return instance()->update_allow_erasing(@additional_args);
}

sub makecache () {
Expand Down
2 changes: 1 addition & 1 deletion lib/Elevate/PkgMgr/Base.pm
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ sub update_with_options ( $self, $options, $pkgs ) {
die "update_with_options unimplemented";
}

sub update_allow_erasing ( $self, @args ) {
sub update_allow_erasing ( $self, @additional_args ) {
die "update_allow_erasing unimplemented";
}

Expand Down
11 changes: 7 additions & 4 deletions lib/Elevate/PkgMgr/YUM.pm
Original file line number Diff line number Diff line change
Expand Up @@ -254,13 +254,16 @@ sub update_with_options ( $self, $options, $pkgs ) {
return;
}

sub update_allow_erasing ( $self, @args ) {
sub update_allow_erasing ( $self, @additional_args ) {
my $pkgmgr = $self->_pkgmgr();

my @additional_args = scalar @args ? @args : '';

$self->ssystem( $pkgmgr, '-y', '--allowerasing', @additional_args, 'update' );
my @args = (
'-y',
'--allowerasing',
);

push @args, @additional_args;
$self->ssystem_and_die( $pkgmgr, @args, 'update' );
return;
}

Expand Down

0 comments on commit aff273e

Please sign in to comment.