Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #392 from kirtangajjar/feature/dynamic-subnet-allo…
…cation Add migration for iproute2
- Loading branch information
Showing
3 changed files
with
61 additions
and
3 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
migrations/container/20210902112747_site-command_install_iproute2.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
namespace EE\Migration; | ||
|
||
use EE; | ||
use EE\Migration\Base; | ||
use EE\RevertableStepProcessor; | ||
use EE\Model\Site; | ||
|
||
class InstallIproute2 extends Base { | ||
|
||
private $sites; | ||
/** @var RevertableStepProcessor $rsp Keeps track of migration state. Reverts on error */ | ||
private static $rsp; | ||
|
||
/** | ||
* Execute php config updates. | ||
* | ||
* @throws EE\ExitException | ||
*/ | ||
public function up() { | ||
|
||
if ( $this->skip_this_migration ) { | ||
EE::debug( 'Skipping add-ext-config-8.0 update migration as it is not needed.' ); | ||
|
||
return; | ||
} | ||
|
||
$os = php_uname( 'v' ); | ||
$ip_command_present = EE::launch( 'command -v ip' )->return_code === 0; | ||
|
||
if ( ( strpos( $os, 'Ubuntu') !== false || strpos( $os, 'Debian' ) !== false ) | ||
&& ! $ip_command_present ) { | ||
EE::exec( 'bash -c \'if command -v apt; then apt install -y iproute2; fi\'' ); | ||
} | ||
} | ||
|
||
/** | ||
* Bring back the existing old php config. | ||
* | ||
* @throws EE\ExitException | ||
*/ | ||
public function down() { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters