Skip to content

Commit 0fada8d

Browse files
committed
Add support for java 21 for debian packages
1 parent c7667d8 commit 0fada8d

4 files changed

Lines changed: 27 additions & 18 deletions

File tree

‎client/bindir/cloud-update-xenserver-licenses.in‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ import glob
2424
from random import choice
2525
import string
2626
from optparse import OptionParser
27-
import mysql.connector
27+
try:
28+
import mysql.connector as mysqldb
29+
except ImportError:
30+
import pymysql as mysqldb
2831
import paramiko
2932
from threading import Thread
3033

@@ -71,7 +74,7 @@ def e(msg):
7174

7275

7376
def getknownhosts(host, username, password):
74-
conn = mysql.connector.connect(host=host, user=username, password=password)
77+
conn = mysqldb.connect(host=host, user=username, password=password)
7578
cur = conn.cursor()
7679
cur.execute(
7780
"SELECT h.private_ip_address,d.value FROM cloud.host h inner join cloud.host_details d on (h.id = d.host_id) where d.name = 'username' and setup = 1"

‎debian/control‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ Source: cloudstack
22
Section: libs
33
Priority: extra
44
Maintainer: The Apache CloudStack Team <dev@cloudstack.apache.org>
5-
Build-Depends: debhelper (>= 9), openjdk-17-jdk | java17-sdk | java17-jdk | zulu-17 | openjdk-11-jdk | java11-sdk | java11-jdk | zulu-11, genisoimage,
6-
python-mysql.connector | python3-mysql.connector | mysql-connector-python-py3, maven (>= 3) | maven3,
5+
Build-Depends: debhelper (>= 9), openjdk-17-jdk | java17-sdk | java17-jdk | zulu-17 | openjdk-21-jdk | java21-sdk | java21-jdk | zulu-21 | openjdk-11-jdk | java11-sdk | java11-jdk | zulu-11, genisoimage,
6+
python-mysql.connector | python3-mysql.connector | mysql-connector-python-py3 | python3-pymysql, maven (>= 3) | maven3,
77
python3 (>= 3), python3-setuptools,
88
nodejs (>= 12), lsb-release, dh-systemd | debhelper (>= 13)
99
Standards-Version: 3.8.1
@@ -17,14 +17,14 @@ Description: A common package which contains files which are shared by several C
1717

1818
Package: cloudstack-management
1919
Architecture: all
20-
Depends: ${python3:Depends}, openjdk-17-jre-headless | java17-runtime-headless | java17-runtime | zulu-17, cloudstack-common (= ${source:Version}), net-tools, sudo, python3-mysql.connector | mysql-connector-python-py3, augeas-tools, mysql-client | mariadb-client, adduser, bzip2, ipmitool, file, gawk, iproute2, qemu-utils, rng-tools, python3-dnspython, lsb-release, init-system-helpers (>= 1.14~), python3-setuptools
20+
Depends: ${python3:Depends}, openjdk-17-jre-headless | java17-runtime-headless | java17-runtime | zulu-17 | openjdk-21-jre-headless | java21-runtime-headless | java21-runtime | zulu-21, cloudstack-common (= ${source:Version}), net-tools, sudo, python3-mysql.connector | mysql-connector-python-py3 | python3-pymysql, augeas-tools, mysql-client | mariadb-client, adduser, bzip2, ipmitool, file, gawk, iproute2, qemu-utils, rng-tools, python3-dnspython, lsb-release, init-system-helpers (>= 1.14~), python3-setuptools
2121
Conflicts: cloud-server, cloud-client, cloud-client-ui
2222
Description: CloudStack server library
2323
The CloudStack management server
2424

2525
Package: cloudstack-agent
2626
Architecture: all
27-
Depends: ${python:Depends}, ${python3:Depends}, openjdk-17-jre-headless | java17-runtime-headless | java17-runtime | zulu-17, cloudstack-common (= ${source:Version}), lsb-base (>= 9), openssh-client, qemu-kvm (>= 2.5) | qemu-system-x86 (>= 5.2), libvirt-bin (>= 1.3) | libvirt-daemon-system (>= 3.0), iproute2, ebtables, vlan, ipset, python3-libvirt, ethtool, iptables, cryptsetup, rng-tools, rsync, ovmf, swtpm, lsb-release, ufw, apparmor, cpu-checker, libvirt-daemon-driver-storage-rbd, sysstat
27+
Depends: ${python:Depends}, ${python3:Depends}, openjdk-17-jre-headless | java17-runtime-headless | java17-runtime | zulu-17 | openjdk-21-jre-headless | java21-runtime-headless | java21-runtime | zulu-21, cloudstack-common (= ${source:Version}), lsb-base (>= 9), openssh-client, qemu-kvm (>= 2.5) | qemu-system-x86 (>= 5.2), libvirt-bin (>= 1.3) | libvirt-daemon-system (>= 3.0), iproute2, ebtables, vlan, ipset, python3-libvirt, ethtool, iptables, cryptsetup, rng-tools, rsync, ovmf, swtpm, lsb-release, ufw, apparmor, cpu-checker, libvirt-daemon-driver-storage-rbd, sysstat
2828
Recommends: init-system-helpers
2929
Conflicts: cloud-agent, cloud-agent-libs, cloud-agent-deps, cloud-agent-scripts
3030
Description: CloudStack agent
@@ -34,7 +34,7 @@ Description: CloudStack agent
3434

3535
Package: cloudstack-usage
3636
Architecture: all
37-
Depends: openjdk-17-jre-headless | java17-runtime-headless | java17-runtime | zulu-17, cloudstack-common (= ${source:Version}), init-system-helpers
37+
Depends: openjdk-17-jre-headless | java17-runtime-headless | java17-runtime | zulu-17 | openjdk-21-jre-headless | java21-runtime-headless | java21-runtime | zulu-21, cloudstack-common (= ${source:Version}), init-system-helpers
3838
Description: CloudStack usage monitor
3939
The CloudStack usage monitor provides usage accounting across the entire cloud for
4040
cloud operators to charge based on usage parameters.

‎python/lib/cloudutils/db.py‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@
1717
import os
1818
from .utilities import bash
1919
from .cloudException import CloudRuntimeException
20-
import mysql.connector
20+
try:
21+
import mysql.connector as mysqldb
22+
except ImportError:
23+
import pymysql as mysqldb
2124

2225
class Database(object):
2326
"""Database connection"""
@@ -29,10 +32,10 @@ def __init__(self, username, password=None, host='localhost', port='3306', db="c
2932
self.db = db
3033

3134
def connect(self):
32-
return mysql.connector.connect(host=self.host,
33-
user=self.username,
34-
password=self.password,
35-
database=self.db)
35+
return mysqldb.connect(host=self.host,
36+
user=self.username,
37+
password=self.password,
38+
database=self.db)
3639

3740
def execute(self, statement):
3841
txn = None

‎scripts/util/migrate-dynamicroles.py‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,13 @@
2525
from optparse import OptionParser
2626

2727
try:
28-
import mysql.connector
28+
import mysql.connector as mysqldb
2929
except ImportError:
30-
print("mysql.connector cannot be imported, please install mysql-connector-python")
31-
sys.exit(1)
30+
try:
31+
import pymysql as mysqldb
32+
except ImportError:
33+
print("Neither mysql.connector nor pymysql can be imported, please install mysql-connector-python or PyMySQL")
34+
sys.exit(1)
3235

3336
dryrun = False
3437

@@ -92,12 +95,12 @@ def main():
9295
if options.dryrun:
9396
dryrun = True
9497

95-
conn = mysql.connector.connect(
98+
conn = mysqldb.connect(
9699
host=options.host,
97100
user=options.user,
98-
passwd=options.password,
101+
password=options.password,
99102
port=int(options.port),
100-
db=options.db)
103+
database=options.db)
101104

102105
if options.defaultRules:
103106
print("Applying the default role permissions, ignoring any provided properties files(s).")

0 commit comments

Comments
 (0)