Skip to content
Open
Changes from all 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
16 changes: 8 additions & 8 deletions contrail_config_functions
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ function replace_contrail_dns_conf()
function check_dev()
{
interface=$1
arr=$(ifconfig | awk '{print $1}')
arr=$(sudo ifconfig | awk '{print $1}')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure? I don't see any issue with running ifconfig as non-root user.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/sbin was not in ubuntu user PATH when I opened this PR. It is now on /etc/environment in the install I have access to. However I do not know if something has modified this file on this system and I do not have access to a vanilla install.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is true. The install Guides should add the export PATH=${PATH}:/sbin as a recommendation for the user's environment (typically "stack")

if [[ " ${arr[*]} " == *"$interface"* ]]; then
echo "interface found"

Expand Down Expand Up @@ -502,7 +502,7 @@ function get_if_mtu()
{
mtu=''
interface=$1
mtu=$(ifconfig $interface|grep MTU | awk 'BEGIN{FS=OFS="MTU"}{print $2}'|awk 'BEGIN{FS=OFS=":"}{print $2}'|awk '{print $1}')
mtu=$(sudo ifconfig $interface|grep MTU | awk 'BEGIN{FS=OFS="MTU"}{print $2}'|awk 'BEGIN{FS=OFS=":"}{print $2}'|awk '{print $1}')
if [[ $mtu -eq 1500 ]]; then
mtu=''
fi
Expand All @@ -521,10 +521,10 @@ function get_Mask()
{
interface=$1
if is_ubuntu; then
mask=$(ifconfig $interface|grep Mask | awk 'BEGIN{FS=OFS="Mask"}{print $2}'|awk 'BEGIN{FS=OFS=":"}{print $2}')
mask=$(sudo ifconfig $interface|grep Mask | awk 'BEGIN{FS=OFS="Mask"}{print $2}'|awk 'BEGIN{FS=OFS=":"}{print $2}')
echo $mask
else
mask=$(ifconfig $interface|sed -ne 's/.*[[net]*]*mask[: ]*\([0-9.]*\).*/\1/i p')
mask=$(sudo ifconfig $interface|sed -ne 's/.*[[net]*]*mask[: ]*\([0-9.]*\).*/\1/i p')
echo $mask
fi
}
Expand All @@ -533,10 +533,10 @@ function get_management_ip()
{
interface=$1
if is_ubuntu; then
management_ip=$(ifconfig $interface|grep -e addr| awk 'BEGIN{FS=OFS="net addr"}{print $2}'|awk '{print $1}'|awk 'BEGIN{FS=OFS=":"}{print $2}')
management_ip=$(sudo ifconfig $interface|grep -e addr| awk 'BEGIN{FS=OFS="net addr"}{print $2}'|awk '{print $1}'|awk 'BEGIN{FS=OFS=":"}{print $2}')
echo $management_ip
else
management_ip=$(ifconfig $interface|sed -ne 's/.*inet [[addr]*]*[: ]*\([0-9.]*\).*/\1/i p')
management_ip=$(sudo ifconfig $interface|sed -ne 's/.*inet [[addr]*]*[: ]*\([0-9.]*\).*/\1/i p')
echo $management_ip
fi
}
Expand Down Expand Up @@ -665,9 +665,9 @@ function get_Mac()
{
interface=$1
if is_ubuntu; then
mac=$(ifconfig $interface|grep HWaddr | awk '{print $5}')
mac=$(sudo ifconfig $interface|grep HWaddr | awk '{print $5}')
elif is_fedora; then
mac=$(ifconfig $interface|grep ether | awk '{print $2}')
mac=$(sudo ifconfig $interface|grep ether | awk '{print $2}')
fi
echo $mac

Expand Down