Skip to content

Commit 5955128

Browse files
authored
Merge branch 'main' into pre-commit-update-codespell
2 parents 0e9c755 + 33cfede commit 5955128

File tree

106 files changed

+1722
-1126
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+1722
-1126
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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+
name: CodeQL Analysis
19+
on:
20+
push:
21+
branches: [main]
22+
pull_request:
23+
branches: [main]
24+
permissions:
25+
actions: read
26+
contents: read
27+
security-events: write
28+
jobs:
29+
codeql:
30+
name: CodeQL
31+
runs-on: ubuntu-latest
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
language: ["actions"]
36+
steps:
37+
- name: Checkout repository
38+
uses: actions/checkout@v4
39+
- name: Initialize CodeQL
40+
uses: github/codeql-action/init@v3
41+
with:
42+
languages: ${{ matrix.language }}
43+
- name: Autobuild
44+
uses: github/codeql-action/autobuild@v3
45+
- name: Perform CodeQL Analysis
46+
uses: github/codeql-action/analyze@v3
47+
with:
48+
category: "Security"

.pre-commit-config.yaml

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ repos:
3939
- id: check-case-conflict
4040
#- id: check-executables-have-shebangs
4141
- id: check-merge-conflict
42+
- id: check-shebang-scripts-are-executable
43+
files: \.sh$
4244
- id: check-symlinks
4345
- id: check-vcs-permalinks
4446
#- id: check-yaml
@@ -68,7 +70,7 @@ repos:
6870
- id: mixed-line-ending
6971
exclude: \.cs$
7072
- id: trailing-whitespace
71-
files: \.(bat|cfg|cs|css|gitignore|header|in|install|java|md|properties|py|rb|sh|sql|txt|vue|xml|xsl|yaml|yml)$
73+
files: \.(bat|cfg|cs|css|gitignore|header|in|install|java|md|properties|py|rb|rc|sh|sql|te|template|txt|ucls|vue|xml|xsl|yaml|yml)$|^cloud-cli/bindir/cloud-tool$|^debian/changelog$
7274
args: [--markdown-linebreak-ext=md]
7375
exclude: ^services/console-proxy/rdpconsole/src/test/doc/freerdp-debug-log\.txt$
7476
- repo: https://github.com/codespell-project/codespell
@@ -84,17 +86,6 @@ repos:
8486
hooks:
8587
- id: flake8
8688
args: [--config, .github/linters/.flake8]
87-
exclude: >
88-
(?x)
89-
^agent/bindir/cloud-setup-agent\.in$|
90-
^client/bindir/cloud-update-xenserver-licenses\.in$|
91-
^cloud-cli/bindir/cloud-tool$|
92-
^python/bindir/cloud-grab-dependent-library-versions$|
93-
^python/bindir/cloud-setup-baremetal$|
94-
^scripts/vm/hypervisor/xenserver/storagePlugin$|
95-
^scripts/vm/hypervisor/xenserver/vmopspremium$|
96-
^setup/bindir/cloud-setup-encryption\.in$|
97-
^venv/.*$
9889
- repo: https://github.com/igorshubovych/markdownlint-cli
9990
rev: v0.45.0
10091
hooks:

agent/bindir/cloud-setup-agent.in

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,62 +35,70 @@ for pythonpath in (
3535

3636
from cloudutils.cloudException import CloudRuntimeException, CloudInternalException
3737
from cloudutils.utilities import initLoging, bash
38-
from cloudutils.configFileOps import configFileOps
38+
from cloudutils.configFileOps import configFileOps
3939
from cloudutils.globalEnv import globalEnv
4040
from cloudutils.networkConfig import networkConfig
4141
from cloudutils.syscfg import sysConfigFactory
4242
from cloudutils.serviceConfig import configureLibvirtConfig, configure_libvirt_tls
4343

4444
from optparse import OptionParser
4545

46+
4647
def getUserInputs():
4748
print("Welcome to the CloudStack Agent Setup:")
4849

4950
cfo = configFileOps("@AGENTSYSCONFDIR@/agent.properties")
5051
oldMgt = cfo.getEntry("host")
5152

52-
mgtSvr = input("Please input the Management Server Hostname/IP-Address:[%s]"%oldMgt)
53+
mgtSvr = input(
54+
"Please input the Management Server Hostname/IP-Address:[%s]" % oldMgt
55+
)
5356
if mgtSvr == "":
5457
mgtSvr = oldMgt
5558
try:
5659
socket.getaddrinfo(mgtSvr, 443)
5760
except:
58-
print("Failed to resolve %s. Please input a valid hostname or IP-Address."%mgtSvr)
61+
print(
62+
"Failed to resolve %s. Please input a valid hostname or IP-Address."
63+
% mgtSvr
64+
)
5965
exit(1)
6066

6167
oldToken = cfo.getEntry("zone")
62-
zoneToken = input("Please input the Zone Id:[%s]"%oldToken)
68+
zoneToken = input("Please input the Zone Id:[%s]" % oldToken)
6369

6470
if zoneToken == "":
6571
zoneToken = oldToken
6672

6773
oldPod = cfo.getEntry("pod")
68-
podId = input("Please input the Pod Id:[%s]"%oldPod)
74+
podId = input("Please input the Pod Id:[%s]" % oldPod)
6975

7076
if podId == "":
71-
podId = oldToken
77+
podId = oldToken
7278

7379
oldCluster = cfo.getEntry("cluster")
74-
clusterId = input("Please input the Cluster Id:[%s]"%oldCluster)
80+
clusterId = input("Please input the Cluster Id:[%s]" % oldCluster)
7581
if clusterId == "":
7682
clusterId = oldCluster
7783

7884
oldHypervisor = cfo.getEntry("hypervisor")
7985
if oldHypervisor == "":
8086
oldHypervisor = "kvm"
8187

82-
hypervisor = input("Please input the Hypervisor type kvm/lxc:[%s]"%oldHypervisor)
88+
hypervisor = input("Please input the Hypervisor type kvm/lxc:[%s]" % oldHypervisor)
8389
if hypervisor == "":
8490
hypervisor = oldHypervisor
8591

8692
try:
8793
defaultNic = networkConfig.getDefaultNetwork()
8894
except:
89-
print("Failed to get default route. Please configure your network to have a default route")
95+
print(
96+
"Failed to get default route. Please configure your network to have a default route"
97+
)
9098
exit(1)
9199

92100
defNic = defaultNic.name
93-
network = input("Please choose which network used to create VM:[%s]"%defNic)
101+
network = input("Please choose which network used to create VM:[%s]" % defNic)
94102
if network == "":
95103
if defNic == "":
96104
print("You need to specify one of Nic or bridge on your system")
@@ -100,21 +108,32 @@ def getUserInputs():
100108

101109
return [mgtSvr, zoneToken, network, podId, clusterId, hypervisor]
102110

103-
if __name__ == '__main__':
111+
112+
if __name__ == "__main__":
104113
initLoging("@AGENTLOGDIR@/setup.log")
105114
glbEnv = globalEnv()
106115

107116
glbEnv.mode = "Agent"
108117
glbEnv.agentMode = "Agent"
109118
parser = OptionParser()
110119
parser.add_option("-a", action="store_true", dest="auto", help="auto mode")
111-
parser.add_option("-m", "--host", dest="mgt", help="Management server hostname or IP-Address")
120+
parser.add_option(
121+
"-m", "--host", dest="mgt", help="Management server hostname or IP-Address"
122+
)
112123
parser.add_option("-z", "--zone", dest="zone", help="zone id")
113124
parser.add_option("-p", "--pod", dest="pod", help="pod id")
114125
parser.add_option("-c", "--cluster", dest="cluster", help="cluster id")
115-
parser.add_option("-t", "--hypervisor", default="kvm", dest="hypervisor", help="hypervisor type")
126+
parser.add_option(
127+
"-t", "--hypervisor", default="kvm", dest="hypervisor", help="hypervisor type"
128+
)
116129
parser.add_option("-g", "--guid", dest="guid", help="guid")
117-
parser.add_option("-s", action="store_true", default=False, dest="secure", help="Secure and enable TLS for libvirtd")
130+
parser.add_option(
131+
"-s",
132+
action="store_true",
133+
default=False,
134+
dest="secure",
135+
help="Secure and enable TLS for libvirtd",
136+
)
118137
parser.add_option("--pubNic", dest="pubNic", help="Public traffic interface")
119138
parser.add_option("--prvNic", dest="prvNic", help="Private traffic interface")
120139
parser.add_option("--guestNic", dest="guestNic", help="Guest traffic interface")
@@ -140,15 +159,15 @@ if __name__ == '__main__':
140159
glbEnv.pod = userInputs[3]
141160
glbEnv.cluster = userInputs[4]
142161
glbEnv.hypervisor = userInputs[5]
143-
#generate UUID
162+
# generate UUID
144163
glbEnv.uuid = old_config.getEntry("guid")
145164
if glbEnv.uuid == "":
146165
glbEnv.uuid = bash("uuidgen").getStdout()
147166
else:
148167
for para, value in list(options.__dict__.items()):
149168
if value is None:
150-
print("Missing operand:%s"%para)
151-
print("Try %s --help for more information"%sys.argv[0])
169+
print("Missing operand:%s" % para)
170+
print("Try %s --help for more information" % sys.argv[0])
152171
sys.exit(1)
153172

154173
glbEnv.uuid = options.guid
@@ -168,7 +187,7 @@ if __name__ == '__main__':
168187
try:
169188
syscfg.config()
170189
print("CloudStack Agent setup is done!")
171-
except (CloudRuntimeException,CloudInternalException) as e:
190+
except (CloudRuntimeException, CloudInternalException) as e:
172191
print(e)
173192
print("Try to restore your system:")
174193
try:

agent/conf/developer.properties.template

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
# to you under the Apache License, Version 2.0 (the
66
# "License"); you may not use this file except in compliance
77
# with the License. You may obtain a copy of the License at
8-
#
8+
#
99
# http://www.apache.org/licenses/LICENSE-2.0
10-
#
10+
#
1111
# Unless required by applicable law or agreed to in writing,
1212
# software distributed under the License is distributed on an
1313
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY

api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLoadBalancerRuleCmd.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import com.cloud.network.rules.FirewallRule;
3434
import com.cloud.network.rules.LoadBalancer;
3535
import com.cloud.user.Account;
36+
import java.util.List;
3637

3738
@APICommand(name = "updateLoadBalancerRule", description = "Updates load balancer", responseObject = LoadBalancerResponse.class,
3839
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
@@ -64,6 +65,9 @@ public class UpdateLoadBalancerRuleCmd extends BaseAsyncCustomIdCmd {
6465
@Parameter(name = ApiConstants.PROTOCOL, type = CommandType.STRING, description = "The protocol for the LB")
6566
private String lbProtocol;
6667

68+
@Parameter(name = ApiConstants.CIDR_LIST, type = CommandType.LIST, collectionType = CommandType.STRING, description = "the cidr list to forward traffic from", since = "4.22")
69+
private List<String> cidrList;
70+
6771
/////////////////////////////////////////////////////
6872
/////////////////// Accessors ///////////////////////
6973
/////////////////////////////////////////////////////
@@ -92,6 +96,9 @@ public String getLbProtocol() {
9296
return lbProtocol;
9397
}
9498

99+
public List<String> getCidrList() {
100+
return cidrList;
101+
}
95102
/////////////////////////////////////////////////////
96103
/////////////// API Implementation///////////////////
97104
/////////////////////////////////////////////////////

0 commit comments

Comments
 (0)