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
64a39a6c
Commit
64a39a6c
authored
9 years ago
by
Jenkins
Committed by
Gerrit Code Review
9 years ago
Browse files
Options
Downloads
Plain Diff
Merge "Simplify logic of set_configs.py a little bit"
parents
50f4bc52
735deace
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 @
64a39a6c
...
...
@@ -67,12 +67,8 @@ def validate_source(data):
def
is_zk_transport
(
path
):
if
path
.
startswith
(
'
zk://
'
):
return
True
if
os
.
environ
.
get
(
"
KOLLA_ZK_HOSTS
"
)
is
not
None
:
return
True
return
False
return
path
.
startswith
(
'
zk://
'
)
or
\
os
.
environ
.
get
(
"
KOLLA_ZK_HOSTS
"
)
is
not
None
@contextlib.contextmanager
...
...
@@ -175,14 +171,9 @@ def set_permissions(data):
# Give config file proper perms.
try
:
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
)
except
OSError
as
e
:
LOG
.
error
(
'
While trying to chmod {} received error
: {}
'
.
format
(
LOG
.
error
(
'
Error while setting permissions for {}
: {}
'
.
format
(
file_
,
e
))
sys
.
exit
(
1
)
...
...
@@ -192,15 +183,13 @@ def set_permissions(data):
# Check for user and group id in the environment.
try
:
u
id
=
getpwnam
(
owner
)
.
pw_uid
u
ser
=
getpwnam
(
owner
)
except
KeyError
:
LOG
.
error
(
'
The specified user does not exist: {}
'
.
format
(
owner
))
sys
.
exit
(
1
)
try
:
gid
=
getpwnam
(
owner
).
pw_gid
except
KeyError
:
LOG
.
error
(
'
The specified group does not exist: {}
'
.
format
(
owner
))
sys
.
exit
(
1
)
uid
=
user
.
pw_uid
gid
=
user
.
pw_gid
# Set permissions on the top level dir or file
set_perms
(
dest
,
uid
,
gid
,
perm
)
...
...
@@ -266,12 +255,8 @@ def load_config():
def
execute_config_strategy
():
try
:
config_strategy
=
os
.
environ
.
get
(
"
KOLLA_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
)
config_strategy
=
os
.
environ
.
get
(
"
KOLLA_CONFIG_STRATEGY
"
)
LOG
.
info
(
'
Kolla config strategy set to: {}
'
.
format
(
config_strategy
))
if
config_strategy
==
"
COPY_ALWAYS
"
:
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