Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
defaultgw
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cloud
charms
defaultgw
Commits
55d9d913
Commit
55d9d913
authored
5 years ago
by
Claudio Pisa
Browse files
Options
Downloads
Patches
Plain Diff
improve readability
parent
3584dd2a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
hooks/install
+17
-8
17 additions, 8 deletions
hooks/install
with
17 additions
and
8 deletions
hooks/install
+
17
−
8
View file @
55d9d913
...
...
@@ -5,7 +5,7 @@
set
-x
status-set maintenance
"Setting the default gateway"
GATEWAY
=
"
$(
config-get gateway
)
"
GATEWAY
=
"
$(
config-get gateway
)
"
if
[
-z
"
$GATEWAY
"
]
;
then
juju-log
"Gateway option is empty. Exiting..."
...
...
@@ -13,22 +13,31 @@ if [ -z "$GATEWAY" ]; then
exit
0
fi
GATEWAY_IP
=
`
echo
"
$GATEWAY
"
|
awk
-F
"/"
'{print $1}'
`
GATEWAY_IP
=
"
$(
echo
"
$GATEWAY
"
|
awk
-F
"/"
'{print $1}'
)
"
source
/etc/lsb-release
RELEASE_MAJOR
=
"
$(
echo
$DISTRIB_RELEASE
|
awk
-F
'.'
'{print $1}'
)
"
RELEASE_MAJOR
=
"
$(
echo
$DISTRIB_RELEASE
|
awk
-F
'.'
'{print $1}'
)
"
if
[
"
$RELEASE_MAJOR
"
-le
"16"
]
;
then
# Ubuntu release is less or equal than trusty
# copy metric 0 routes to routes with metric 1
ip route show |
grep
"^default"
|
grep
-v
metric |
while
read
line
;
do
ip route append
$line
metric 1
||
true
;
done
ip route show |
grep
"^default"
|
grep
-v
metric |
while
read
line
;
do
ip route append
$line
metric 1
||
true
done
# delete metric 0 routes
ip route show |
grep
"^default"
|
grep
-v
metric |
while
read
line
;
do
ip route del
$line
metric 0
;
done
else
# release is not less or equal than trusty
ip route show |
grep
"^default"
|
grep
-v
metric |
while
read
line
;
do
ip route del
$line
metric 0
done
else
# copy metric 0 routes to routes with metric 1
ip route show default metric 0 |
while
read
line
;
do
ip route append
$line
metric 1
||
true
;
done
ip route show default metric 0 |
while
read
line
;
do
ip route append
$line
metric 1
||
true
done
# delete metric 0 routes
ip route show default metric 0 |
while
read
line
;
do
ip route del
$line
metric 0
;
done
ip route show default metric 0 |
while
read
line
;
do
ip route del
$line
metric 0
done
fi
# add our route
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment