diff options
author | Tim Rozet <trozet@redhat.com> | 2015-09-08 16:00:46 -0400 |
---|---|---|
committer | Tim Rozet <trozet@redhat.com> | 2015-09-08 21:40:40 +0000 |
commit | d689ac34fd5844888decbdb973275a6bf20264c0 (patch) | |
tree | d6129c053d2fb7664b7d3c709318b64e3e26eb27 /foreman | |
parent | e65ed372ee84b1f634ec24002fb7bfd7d48fd7e7 (diff) |
Adds check to ensure that provided static_ip_range param is correct
Patch adds a check to make sure that the user specified static_ip_range
argument (Ex. 192.168.0.10,192.168.0.20) falls within the valid public
subnet of the host (the same subnet as the default gateway).
JIRA: APEX-19
Change-Id: Ifc0b79074b887509617c2749e50d97d1800abad0
Signed-off-by: Tim Rozet <trozet@redhat.com>
(cherry picked from commit 50fe670726f2229ef963517a890fef2d821b8821)
Diffstat (limited to 'foreman')
-rwxr-xr-x | foreman/ci/deploy.sh | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/foreman/ci/deploy.sh b/foreman/ci/deploy.sh index 6771da0..0803993 100755 --- a/foreman/ci/deploy.sh +++ b/foreman/ci/deploy.sh @@ -539,6 +539,13 @@ configure_network() { ##set variable info if [ ! -z "$static_ip_range" ]; then new_ip=$(echo $static_ip_range | cut -d , -f1) + subnet_mask=$(find_netmask $this_default_gw_interface) + host_subnet=$(find_subnet $interface_ip $subnet_mask) + ip_range_subnet=$(find_subnet $new_ip $subnet_mask) + if [ "$ip_range_subnet" != "$host_subnet" ]; then + echo "${red}static_ip_range: ${static_ip_range} is not in the same subnet as your default gateway interface: ${host_subnet}. Please use a correct range!${reset}" + exit 1 + fi else new_ip=$(next_usable_ip $interface_ip) if [ ! "$new_ip" ]; then |