Skip to content

Commit

Permalink
Issue #3408: remove FromCloud from PackageInstall() and RepositoryAdd()
Browse files Browse the repository at this point in the history
  • Loading branch information
bschmalhofer committed May 24, 2024
1 parent f3e2ad7 commit cc6125c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 27 deletions.
10 changes: 1 addition & 9 deletions Kernel/Modules/AdminPackageManager.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2170,13 +2170,6 @@ sub _InstallHandling {
}
$RepositoryCloudList //= {};

# in case Source is present on repository cloud list
# the package should be retrieved using the CloudService backend
my $FromCloud = 0;
if ( $Param{Source} && $RepositoryCloudList->{ $Param{Source} } ) {
$FromCloud = 1;
}

my %Response = $PackageObject->AnalyzePackageFrameworkRequirements(
Framework => $Structure{Framework},
NoLog => 1,
Expand Down Expand Up @@ -2257,8 +2250,7 @@ sub _InstallHandling {
# install package
elsif (
$PackageObject->PackageInstall(
String => $Param{Package},
FromCloud => $FromCloud
String => $Param{Package},
)
)
{
Expand Down
23 changes: 7 additions & 16 deletions Kernel/System/Package.pm
Original file line number Diff line number Diff line change
Expand Up @@ -330,11 +330,10 @@ sub RepositoryGet {

=head2 RepositoryAdd()
add a package to local repository
add a package to the local repository, that is the database table I<package_repository>.
$PackageObject->RepositoryAdd(
String => $FileString,
FromCloud => 0, # optional 1 or 0, it indicates if package came from Cloud or not
);
=cut
Expand All @@ -351,9 +350,6 @@ sub RepositoryAdd {
return;
}

# get from cloud flag
$Param{FromCloud} //= 0;

# get package attributes
my %Structure = $Self->PackageParse(%Param);

Expand All @@ -362,6 +358,7 @@ sub RepositoryAdd {
Priority => 'error',
Message => 'Invalid Package!',
);

return;
}
if ( !$Structure{Name} ) {
Expand Down Expand Up @@ -479,7 +476,6 @@ installs a package when it is not installed yet. Upgrades a package when it is a
$PackageObject->PackageInstall(
String => $FileString,
Force => 1, # optional 1 or 0, for to install package even if validation fails
FromCloud => 1, # optional 1 or 0, it indicates if package's origin is Cloud or not
);
=cut
Expand All @@ -501,9 +497,6 @@ sub PackageInstall {
# during the installation.
$Self->_RepositoryCacheClear();

# get from cloud flag
my $FromCloud = $Param{FromCloud} || 0;

# conflict check
my %Structure = $Self->PackageParse(%Param);

Expand Down Expand Up @@ -595,9 +588,8 @@ sub PackageInstall {
}

# add package
return if !$Self->RepositoryAdd(
String => $Param{String},
FromCloud => $FromCloud,
return unless $Self->RepositoryAdd(
String => $Param{String},
);

# update package status
Expand Down Expand Up @@ -909,7 +901,7 @@ sub PackageUpgrade {
return if !$Self->RepositoryRemove( Name => $Structure{Name}->{Content} );

# add new package
return if !$Self->RepositoryAdd( String => $Param{String} );
return unless $Self->RepositoryAdd( String => $Param{String} );

# update package status
return if !$Kernel::OM->Get('Kernel::System::DB')->Do(
Expand Down Expand Up @@ -3253,9 +3245,8 @@ sub PackageUpgradeAll {

if ( !$InstalledVersions{$PackageName} ) {
my $InstallSuccess = $Self->PackageInstall(
String => $Package,
FromCloud => $MetaPackage->{FromCloud},
Force => $Param{Force} || 0,
String => $Package,
Force => $Param{Force} || 0,
);
if ( !$InstallSuccess ) {
$Success = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ my $FileString = $MainObject->FileRead(
my $PackageObject = $Kernel::OM->Get('Kernel::System::Package');
my $Success = $PackageObject->RepositoryAdd(
String => ${$FileString},
FromCloud => 0,
);
$Self->True(
$Success,
Expand Down
4 changes: 3 additions & 1 deletion scripts/test/SysConfig/ConfigurationCategoriesGet.t
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,9 @@ for my $Test (@Tests) {
);

if ( $Test->{RepositoryAdd} ) {
my $RepositoryAdd = $PackageObject->RepositoryAdd( String => $Test->{RepositoryAdd}->{String} );
my $RepositoryAdd = $PackageObject->RepositoryAdd(
String => $Test->{RepositoryAdd}->{String}
);
$Self->True(
$RepositoryAdd,
"RepositoryAdd() $Test->{RepositoryAdd}->{PackageName}",
Expand Down

0 comments on commit cc6125c

Please sign in to comment.