Skip to content

Commit 3ff92e8

Browse files
committed
database: fix upgrade paths from 4.5.2 to 4.6.0
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
1 parent 107595a commit 3ff92e8

6 files changed

Lines changed: 140 additions & 72 deletions

File tree

engine/schema/src/com/cloud/upgrade/DatabaseUpgradeChecker.java

Lines changed: 64 additions & 63 deletions
Large diffs are not rendered by default.
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
package com.cloud.upgrade.dao;
19+
20+
import com.cloud.utils.exception.CloudRuntimeException;
21+
import com.cloud.utils.script.Script;
22+
import org.apache.log4j.Logger;
23+
24+
import java.io.File;
25+
import java.sql.Connection;
26+
27+
public class Upgrade451to452 implements DbUpgrade {
28+
final static Logger s_logger = Logger.getLogger(Upgrade451to452.class);
29+
30+
@Override
31+
public String[] getUpgradableVersionRange() {
32+
return new String[] {"4.5.1", "4.5.2"};
33+
}
34+
35+
@Override
36+
public String getUpgradedVersion() {
37+
return "4.5.2";
38+
}
39+
40+
@Override
41+
public boolean supportsRollingUpgrade() {
42+
return false;
43+
}
44+
45+
@Override
46+
public File[] getPrepareScripts() {
47+
String script = Script.findScript("", "db/schema-451to452.sql");
48+
if (script == null) {
49+
throw new CloudRuntimeException("Unable to find db/schema-451to452.sql");
50+
}
51+
return new File[] {new File(script)};
52+
}
53+
54+
@Override
55+
public void performDataMigration(Connection conn) {
56+
}
57+
58+
@Override
59+
public File[] getCleanupScripts() {
60+
String script = Script.findScript("", "db/schema-451to452-cleanup.sql");
61+
if (script == null) {
62+
throw new CloudRuntimeException("Unable to find db/schema-451to452-cleanup.sql");
63+
}
64+
65+
return new File[] {new File(script)};
66+
}
67+
}

engine/schema/src/com/cloud/upgrade/dao/Upgrade451to460.java renamed to engine/schema/src/com/cloud/upgrade/dao/Upgrade452to460.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@
2828
import com.cloud.utils.exception.CloudRuntimeException;
2929
import com.cloud.utils.script.Script;
3030

31-
public class Upgrade451to460 implements DbUpgrade {
32-
final static Logger s_logger = Logger.getLogger(Upgrade451to460.class);
31+
public class Upgrade452to460 implements DbUpgrade {
32+
final static Logger s_logger = Logger.getLogger(Upgrade452to460.class);
3333

3434
@Override
3535
public String[] getUpgradableVersionRange() {
36-
return new String[] { "4.5.1", "4.6.0" };
36+
return new String[] { "4.5.2", "4.6.0" };
3737
}
3838

3939
@Override
@@ -48,9 +48,9 @@ public boolean supportsRollingUpgrade() {
4848

4949
@Override
5050
public File[] getPrepareScripts() {
51-
final String script = Script.findScript("", "db/schema-451to460.sql");
51+
final String script = Script.findScript("", "db/schema-452to460.sql");
5252
if (script == null) {
53-
throw new CloudRuntimeException("Unable to find db/schema-451to460.sql");
53+
throw new CloudRuntimeException("Unable to find db/schema-452to460.sql");
5454
}
5555

5656
return new File[] { new File(script) };
@@ -138,9 +138,9 @@ private void removeBumPriorityColumn(final Connection conn) {
138138

139139
@Override
140140
public File[] getCleanupScripts() {
141-
final String script = Script.findScript("", "db/schema-451to460-cleanup.sql");
141+
final String script = Script.findScript("", "db/schema-452to460-cleanup.sql");
142142
if (script == null) {
143-
throw new CloudRuntimeException("Unable to find db/schema-451to460-cleanup.sql");
143+
throw new CloudRuntimeException("Unable to find db/schema-452to460-cleanup.sql");
144144
}
145145

146146
return new File[] { new File(script) };

plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/ListIdpsCmd.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import javax.servlet.http.HttpServletRequest;
3737
import javax.servlet.http.HttpServletResponse;
3838
import javax.servlet.http.HttpSession;
39+
import java.net.InetAddress;
3940
import java.util.ArrayList;
4041
import java.util.List;
4142
import java.util.Map;
@@ -71,8 +72,7 @@ public void execute() throws ServerApiException {
7172
}
7273

7374
@Override
74-
public String authenticate(String command, Map<String, Object[]> params, HttpSession session, String remoteAddress, String responseType, StringBuilder auditTrailSb, final HttpServletRequest req, final HttpServletResponse resp) throws ServerApiException {
75-
auditTrailSb.append("=== SAML List IdPs ===");
75+
public String authenticate(String command, Map<String, Object[]> params, HttpSession session, InetAddress remoteAddress, String responseType, StringBuilder auditTrailSb, HttpServletRequest req, HttpServletResponse resp) throws ServerApiException {
7676
ListResponse<IdpResponse> response = new ListResponse<IdpResponse>();
7777
List<IdpResponse> idpResponseList = new ArrayList<IdpResponse>();
7878
for (SAMLProviderMetadata metadata: _samlAuthManager.getAllIdPMetadata()) {

0 commit comments

Comments
 (0)