Skip to content

Commit dd21efe

Browse files
authored
refactor: remove 7zip dependency (#37)
Replaced 7ZipforPowerShell dependency with windows tar.exe and reduced number of files being extracted to only the ones we require <!-- markdownlint-disable first-line-h1 no-inline-html --> <!-- Hidden Markdown: Do Not Update this Area. In order to have the best experience with our community, we recommend that you read the code of conduct and contributing guidelines before submitting a pull request. By submitting this pull request, you confirm that you have read, understood, and agreed to the project's code of conduct and contributing guidelines. Please use conventional commits to format the title of the pull request and the commit messages. For more information, please refer to https://www.conventionalcommits.org. -->. ### Summary <!-- Hidden Markdown: Do Not Update this Area. Please provide a clear and concise description of the pull request. -->. ### Type <!-- Hidden Markdown: Do Not Update this Area. Please check the one(s) that applies to this pull request using "x". --> - [ ] Bugfix - [ ] Enhancement or Feature - [ ] Code Style or Formatting - [ ] Documentation - [x] Refactoring - [ ] Chore - [ ] Other Please describe:. ### Breaking Changes? <!-- Hidden Markdown: Do Not Update this Area. Please check the one that applies to this pull request using "x". If this pull request contains a breaking change, please describe the impact and mitigation path. --> - [x] Yes, there are breaking changes. - [ ] No, there are no breaking changes.. ### Test and Documentation <!-- Hidden Markdown: Do Not Update this Area. Please check the one(s) that applies to this pull request using "x". For bug fixes and enhancements/features, please ensure that tests and documentation have been completed and provide details. --> - [x] Tests have been completed. - [x] Documentation has been added or updated. <!-- Hidden Markdown: Do Not Update this Area. Please describe the tests that have been completed and/or the documentation that has been added/updated. -->. ### Issue References <!-- Hidden Markdown: Do Not Update this Area. Is this related to any GitHub issue(s)? If so, please provide the issue number(s) that are closed or resolved by this pull request. For bug fixes and enhancements/features, please ensure that a GitHub issue has been created and provide the issue number(s) here. Please use the 'Closes' keyword followed by the a hash and issue number. This will link the pull request to the issue(s) and automatically close them when the pull request is merged. Example: Closes #000 Closes #1 -->. ### Additional Information <!-- Hidden Markdown: Do Not Update this Area. Please provide any additional information that may be helpful. -->
2 parents e379e8f + 93e64ee commit dd21efe

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

VMware.CloudFoundation.InstanceRecovery.psm1

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,13 @@ Function Confirm-VCFInstanceRecoveryPreReqs {
266266

267267
#Check Dependencies
268268
$jumpboxName = hostname
269-
$is7Zip4PowerShellInstalled = Get-InstalledModule -name "7Zip4PowerShell" -RequiredVersion "2.4.0" -ErrorAction SilentlyContinue
270-
If (!$is7Zip4PowerShellInstalled) {
271-
LogMessage -type WARNING -message "[$jumpboxName] 7Zip4PowerShell Module Missing. Please install"
269+
270+
#Check for windows tar.exe
271+
$isTarInstalled = Test-Path "C:\Windows\System32\tar.exe"
272+
If (!$isTarInstalled) {
273+
LogMessage -type WARNING -message "[$jumpboxName] tar.exe Missing. Please install"
272274
} else {
273-
LogMessage -type INFO -message "[$jumpboxName] 7Zip4PowerShell Module found"
275+
LogMessage -type INFO -message "[$jumpboxName] tar.exe found"
274276
}
275277

276278
$isPoshSSHInstalled = Get-InstalledModule -name "Posh-SSH" -RequiredVersion "3.0.8" -ErrorAction SilentlyContinue
@@ -373,10 +375,11 @@ Function New-ExtractDataFromSDDCBackup {
373375
$command = "openssl enc -d -aes-256-cbc -md sha256 -in $backupFileFullPath -pass pass:`"$encryptionPassword`" -out `"$parentFolder\decrypted-sddc-manager-backup.tar.gz`""
374376
Invoke-Expression "& $command" *>$null
375377

376-
#Extract Backup
378+
#Extract Required Files From Backup Leveraging Windows tar.exe
377379
LogMessage -type INFO -message "[$jumpboxName] Extracting Backup"
378-
Expand-7Zip -ArchiveFileName "$parentFolder\decrypted-sddc-manager-backup.tar.gz" -TargetPath $parentFolder
379-
Expand-7Zip -ArchiveFileName "$parentFolder\decrypted-sddc-manager-backup.tar" -TargetPath $parentFolder
380+
Set-Location "$parentFolder"
381+
tar -xzf "$parentFolder\decrypted-sddc-manager-backup.tar.gz" "$extractedBackupFolder/metadata.json" "$extractedBackupFolder/appliancemanager_dns_configuration.json" "$extractedBackupFolder/appliancemanager_ntp_configuration.json" "$extractedBackupFolder/security_password_vault.json" "$extractedBackupFolder/database/sddc-postgres.bkp"
382+
380383

381384
#Get Content of Password Vault
382385
LogMessage -type INFO -message "[$jumpboxName] Reading Password Vault"

docs/index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ Dependency | Version | Publisher
3737
-----------------------------------------------------|-----------|---------------------------|---------------------------------------------------------------------------
3838
[VMware.PowerCLI][psgallery-module-powercli] | 13.3.0 | Broadcom | :fontawesome-solid-book: &nbsp; [Documentation][developer-module-powercli]
3939
[Posh-SSH][psgallery-module-poshssh] | 3.0.8 | Carlos Perez | :fontawesome-brands-github: &nbsp; [GitHUb][github-module-poshssh]
40-
[7Zip4Powershell][psgallery-module-7zip4powershell] | 2.4.0 | Thomas Freudenberg | :fontawesome-brands-github: &nbsp; [GitHub][github-module-7zip4powershell]
4140
[OpenSSL for Windows][download-win64openssl] | 3.2.1 | Shining Light Productions | :octicons-package-dependencies-24: &nbsp; [Download][download-win64openssl]
4241

4342
[microsoft-powershell]: https://docs.microsoft.com/en-us/powershell

0 commit comments

Comments
 (0)