-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b4ca421
commit 7f8365d
Showing
3 changed files
with
64 additions
and
1 deletion.
There are no files selected for viewing
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
54 changes: 54 additions & 0 deletions
54
java/code/src/com/redhat/rhn/manager/kickstart/cobbler/CobblerSystemRenameCommand.java
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,54 @@ | ||
/* | ||
* Copyright (c) 2024 SUSE LLC | ||
* | ||
* This software is licensed to you under the GNU General Public License, | ||
* version 2 (GPLv2). There is NO WARRANTY for this software, express or | ||
* implied, including the implied warranties of MERCHANTABILITY or FITNESS | ||
* FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2 | ||
* along with this software; if not, see | ||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. | ||
* | ||
* Red Hat trademarks are not licensed under GPLv2. No permission is | ||
* granted to use or replicate Red Hat trademarks that are incorporated | ||
* in this software or its documentation. | ||
*/ | ||
package com.redhat.rhn.manager.kickstart.cobbler; | ||
|
||
import com.redhat.rhn.common.validator.ValidatorError; | ||
import com.redhat.rhn.domain.server.Server; | ||
import com.redhat.rhn.manager.satellite.CobblerSyncCommand; | ||
|
||
import org.cobbler.SystemRecord; | ||
|
||
/** | ||
* Rename system in cobbler | ||
*/ | ||
public class CobblerSystemRenameCommand extends CobblerCommand { | ||
|
||
private Server server; | ||
private String newName; | ||
|
||
/** | ||
* Constructor | ||
* @param serverIn - Server instance being renamed. | ||
* @param newNameIn - new name | ||
*/ | ||
public CobblerSystemRenameCommand(Server serverIn, String newNameIn) { | ||
this.server = serverIn; | ||
this.newName = newNameIn; | ||
} | ||
|
||
/** | ||
* Rename the System in cobbler | ||
* @return ValidatorError | ||
*/ | ||
@Override | ||
public ValidatorError store() { | ||
SystemRecord rec = lookupExisting(server); | ||
if (rec != null) { | ||
rec.setName(CobblerSystemCreateCommand.getCobblerSystemRecordName(newName, server.getOrg().getId())); | ||
return new CobblerSyncCommand(user).store(); | ||
} | ||
return null; | ||
} | ||
} |
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 @@ | ||
- Propagate system rename to Cobbler (bsc#1210455) |