Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;

import org.apache.cloudstack.acl.RoleType;
Expand Down Expand Up @@ -103,14 +105,13 @@

@Override
public List<String> getSourceCidrList() {
if (cidrlist != null) {
if (CollectionUtils.isNotEmpty(cidrlist) && (cidrlist.size() == 1 && StringUtils.isNotBlank(cidrlist.get(0)))) {
return cidrlist;
} else {
List<String> oneCidrList = new ArrayList<String>();
List<String> oneCidrList = new ArrayList<>();

Check warning on line 111 in api/src/main/java/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java

View check run for this annotation

Codecov / codecov/patch

api/src/main/java/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java#L111

Added line #L111 was not covered by tests
oneCidrList.add(NetUtils.ALL_IP4_CIDRS);
return oneCidrList;
}

}

// ///////////////////////////////////////////////////
Expand Down
3 changes: 3 additions & 0 deletions ui/src/views/network/FirewallRules.vue
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,9 @@ export default {
addRule () {
if (this.loading) return
this.loading = true
if (this.newRule.cidrlist == null || this.newRule.cidrlist.trim?.() === '') {
delete this.newRule.cidrlist
}
api('createFirewallRule', { ...this.newRule }).then(response => {
this.$pollJob({
jobId: response.createfirewallruleresponse.jobid,
Expand Down
Loading