Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
Kolla Ansible
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
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
Very Demiurge Very Mindful
Kolla Ansible
Commits
735deace
Commit
735deace
authored
9 years ago
by
Martin André
Browse files
Options
Downloads
Patches
Plain Diff
Simplify logic of set_configs.py a little bit
TrivialFix Change-Id: Ic1c9fc76f4a5725ee76460c727197a96fe5d5359
parent
03fd08d8
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
docker/base/set_configs.py
+9
-24
9 additions, 24 deletions
docker/base/set_configs.py
with
9 additions
and
24 deletions
docker/base/set_configs.py
+
9
−
24
View file @
735deace
...
@@ -69,12 +69,8 @@ def validate_source(data):
...
@@ -69,12 +69,8 @@ def validate_source(data):
def
is_zk_transport
(
path
):
def
is_zk_transport
(
path
):
if
path
.
startswith
(
'
zk://
'
):
return
path
.
startswith
(
'
zk://
'
)
or
\
return
True
os
.
environ
.
get
(
"
KOLLA_ZK_HOSTS
"
)
is
not
None
if
os
.
environ
.
get
(
"
KOLLA_ZK_HOSTS
"
)
is
not
None
:
return
True
return
False
@contextlib.contextmanager
@contextlib.contextmanager
...
@@ -177,14 +173,9 @@ def set_permissions(data):
...
@@ -177,14 +173,9 @@ def set_permissions(data):
# Give config file proper perms.
# Give config file proper perms.
try
:
try
:
os
.
chown
(
file_
,
uid
,
gid
)
os
.
chown
(
file_
,
uid
,
gid
)
except
OSError
as
e
:
LOG
.
error
(
'
While trying to chown {} received error: {}
'
.
format
(
file_
,
e
))
sys
.
exit
(
1
)
try
:
os
.
chmod
(
file_
,
perm
)
os
.
chmod
(
file_
,
perm
)
except
OSError
as
e
:
except
OSError
as
e
:
LOG
.
error
(
'
While trying to chmod {} received error
: {}
'
.
format
(
LOG
.
error
(
'
Error while setting permissions for {}
: {}
'
.
format
(
file_
,
e
))
file_
,
e
))
sys
.
exit
(
1
)
sys
.
exit
(
1
)
...
@@ -194,15 +185,13 @@ def set_permissions(data):
...
@@ -194,15 +185,13 @@ def set_permissions(data):
# Check for user and group id in the environment.
# Check for user and group id in the environment.
try
:
try
:
u
id
=
getpwnam
(
owner
)
.
pw_uid
u
ser
=
getpwnam
(
owner
)
except
KeyError
:
except
KeyError
:
LOG
.
error
(
'
The specified user does not exist: {}
'
.
format
(
owner
))
LOG
.
error
(
'
The specified user does not exist: {}
'
.
format
(
owner
))
sys
.
exit
(
1
)
sys
.
exit
(
1
)
try
:
gid
=
getpwnam
(
owner
).
pw_gid
uid
=
user
.
pw_uid
except
KeyError
:
gid
=
user
.
pw_gid
LOG
.
error
(
'
The specified group does not exist: {}
'
.
format
(
owner
))
sys
.
exit
(
1
)
# Set permissions on the top level dir or file
# Set permissions on the top level dir or file
set_perms
(
dest
,
uid
,
gid
,
perm
)
set_perms
(
dest
,
uid
,
gid
,
perm
)
...
@@ -268,12 +257,8 @@ def load_config():
...
@@ -268,12 +257,8 @@ def load_config():
def
execute_config_strategy
():
def
execute_config_strategy
():
try
:
config_strategy
=
os
.
environ
.
get
(
"
KOLLA_CONFIG_STRATEGY
"
)
config_strategy
=
os
.
environ
.
get
(
"
KOLLA_CONFIG_STRATEGY
"
)
LOG
.
info
(
'
Kolla config strategy set to: {}
'
.
format
(
config_strategy
))
LOG
.
info
(
'
Kolla config strategy set to: {}
'
.
format
(
config_strategy
))
except
KeyError
:
LOG
.
error
(
"
KOLLA_CONFIG_STRATEGY is not set properly.
"
)
sys
.
exit
(
1
)
if
config_strategy
==
"
COPY_ALWAYS
"
:
if
config_strategy
==
"
COPY_ALWAYS
"
:
load_config
()
load_config
()
...
...
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