This repository was archived by the owner on Dec 20, 2022. It is now read-only.
-
Couldn't load subscription status.
- Fork 28
add docker auto-restart options #25
Open
ofir-petrushka
wants to merge
1
commit into
DevTable:master
Choose a base branch
from
ofir-petrushka:ofir-petrushka/add-auto-restart
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,15 +21,15 @@ def __init__(self, manager, config): | |
|
|
||
| # The underlying config for the component. | ||
| self.config = config | ||
|
|
||
| def applyConfigOverrides(self, config_overrides): | ||
| """ Applies the list of configuration overrides to this component's config. | ||
|
|
||
| Format: ['Name=Value', 'Name.SubName=Value'] | ||
| """ | ||
| for override in config_overrides: | ||
| self.config.applyOverride(override) | ||
|
|
||
| def getName(self): | ||
| """ Returns the name of the component. """ | ||
| return self.config.name | ||
|
|
@@ -223,9 +223,7 @@ def start(self): | |
| if self.config.privileged: | ||
| report('Container will be run in privileged mode', component=self) | ||
|
|
||
| client.start(container, binds=self.config.getBindings(container['Id']), | ||
| volumes_from=self.config.volumes_from, | ||
| privileged=self.config.privileged) | ||
| client.start(container) | ||
|
|
||
| # Health check until the instance is ready. | ||
| report('Waiting for health checks...', component=self) | ||
|
|
@@ -309,12 +307,17 @@ def createContainer(self, client): | |
|
|
||
| self.logger.debug('Starting container for component %s with command %s', self.getName(), | ||
| command) | ||
|
|
||
| container = client.create_container(self.config.getFullImage(), command, | ||
| user=self.config.getUser(), | ||
| volumes=self.config.getVolumes(), | ||
| ports=[str(p) for p in self.config.getContainerPorts()], | ||
| environment=self.calculateEnvForComponent()) | ||
| environment=self.calculateEnvForComponent(), | ||
| host_config=client.create_host_config(restart_policy=self.config.getRestartPolicy(), | ||
| volumes_from=self.config.volumes_from, | ||
| binds={ b.external: { "bind": b.volume } for b in self.config.bindings }, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is quite long; maybe breakout the dict construction into its own variable above? |
||
| privileged=self.config.privileged | ||
| ) | ||
| ) | ||
|
|
||
| return container | ||
|
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could do
return self.restart_policy or Noneif you want to shortcut