-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for repairing issues with specific Docker upgrades (#5)
* Added (optional) support for repairing some issues that occur on specific Docker upgrades. * Added automated tests that can be run in Vagrant, for this and other things.
- Loading branch information
Showing
24 changed files
with
815 additions
and
52 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
tests/build | ||
tests/.vagrant |
This file contains 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 |
---|---|---|
@@ -1,2 +1,13 @@ | ||
Version 2.1: | ||
- Change default Docker version to 1.11.2, was 1.5.0 | ||
- Attempt to handle data volume loss when we update from pre-1.10 to post-1.10. | ||
See: https://github.com/docker/docker/issues/20079 | ||
- Attempt to handle missing volume symlinks when we upgrade pre-1.9 data volumes | ||
to a post-1.9.x version. | ||
- Add "docker_attempt_upgrade_fixes" configuration variable. This defaults to False; | ||
the upgrade fixes mentioned above won't be attempted unless it is set to True. | ||
- Added automated tests in the "tests" directory - if you have Vagrant installed, they | ||
can be run by "cd tests ; ./run_tests.sh". | ||
|
||
Version 2.0: | ||
- Port to github |
This file contains 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 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 |
---|---|---|
@@ -1,5 +1,9 @@ | ||
--- | ||
docker_version: 1.5.0 | ||
|
||
kernel_pkg_state: latest | ||
cgroup_lite_pkg_state: latest | ||
ssh_port: 22 | ||
|
||
docker_role_apt_cache_valid_time: 7200 | ||
|
||
docker_attempt_upgrade_fixes: False |
This file contains 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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
--- | ||
# handlers file for docker.ubuntu | ||
|
This file contains 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 |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/usr/bin/env python2.7 | ||
|
||
import json | ||
import os | ||
import os.path | ||
|
||
DOCUMENTATION = ''' | ||
--- | ||
module: collect_container_configs | ||
short_description: collects container configuration data | ||
description: | ||
- when run, this module collects the contents of container configuration files for | ||
all current containers | ||
- this can be run before an upgrade to store information that would be used after | ||
an upgrade | ||
- this is returned as a single string containing parsable JSON. | ||
''' | ||
|
||
|
||
CONTAINER_ROOT_DIR = '/var/lib/docker/containers' | ||
|
||
|
||
CONFIG_FILENAME_OPTIONS = [ | ||
('config.v3.json', 3), | ||
('config.v2.json', 2), | ||
('config.json', 1) | ||
] | ||
|
||
|
||
def main(): | ||
module = AnsibleModule( | ||
argument_spec=dict(), | ||
supports_check_mode=True) | ||
|
||
configs = {} | ||
config_versions = {} | ||
|
||
if os.path.isdir(CONTAINER_ROOT_DIR): | ||
for container in os.listdir(CONTAINER_ROOT_DIR): | ||
container_path = os.path.join(CONTAINER_ROOT_DIR, container) | ||
if not os.path.isdir(container_path): | ||
# we only expect directories here. Ignore the unexpected | ||
continue | ||
|
||
for basename, version in CONFIG_FILENAME_OPTIONS: | ||
config_path = os.path.join(container_path, basename) | ||
if os.path.isfile(config_path): | ||
break | ||
else: | ||
# no config file was found | ||
continue | ||
|
||
with file(config_path, 'r') as f: | ||
config = json.load(f) | ||
|
||
configs[container] = config | ||
config_versions[container] = version | ||
|
||
module.exit_json( | ||
changed=False, | ||
configs=configs, | ||
config_versions=config_versions) | ||
|
||
|
||
from ansible.module_utils.basic import * | ||
if __name__ == '__main__': | ||
main() |
Oops, something went wrong.