Code Review
/
apex-tripleo-heat-templates.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Merge "Add dependency relationship between nested get_attr targets"
[apex-tripleo-heat-templates.git]
/
docker
/
docker-puppet.py
diff --git
a/docker/docker-puppet.py
b/docker/docker-puppet.py
index
1321167
..
65d3bf3
100755
(executable)
--- a/
docker/docker-puppet.py
+++ b/
docker/docker-puppet.py
@@
-29,9
+29,13
@@
import tempfile
import multiprocessing
log = logging.getLogger()
import multiprocessing
log = logging.getLogger()
-log.setLevel(logging.DEBUG)
ch = logging.StreamHandler(sys.stdout)
ch = logging.StreamHandler(sys.stdout)
-ch.setLevel(logging.DEBUG)
+if os.environ.get('DEBUG', False):
+ log.setLevel(logging.DEBUG)
+ ch.setLevel(logging.DEBUG)
+else:
+ log.setLevel(logging.INFO)
+ ch.setLevel(logging.INFO)
formatter = logging.Formatter('%(asctime)s %(levelname)s: %(message)s')
ch.setFormatter(formatter)
log.addHandler(ch)
formatter = logging.Formatter('%(asctime)s %(levelname)s: %(message)s')
ch.setFormatter(formatter)
log.addHandler(ch)
@@
-145,11
+149,11
@@
for service in (json_data or []):
if not manifest or not config_image:
continue
if not manifest or not config_image:
continue
- log.
debug
('config_volume %s' % config_volume)
- log.
debug
('puppet_tags %s' % puppet_tags)
- log.
debug
('manifest %s' % manifest)
- log.
debug
('config_image %s' % config_image)
- log.
debug
('volumes %s' % volumes)
+ log.
info
('config_volume %s' % config_volume)
+ log.
info
('puppet_tags %s' % puppet_tags)
+ log.
info
('manifest %s' % manifest)
+ log.
info
('config_image %s' % config_image)
+ log.
info
('volumes %s' % volumes)
# We key off of config volume for all configs.
if config_volume in configs:
# Append puppet tags and manifest.
# We key off of config volume for all configs.
if config_volume in configs:
# Append puppet tags and manifest.
@@
-191,15
+195,17
@@
def mp_puppet_config((config_volume, puppet_tags, manifest, config_image, volume
TAGS="--tags \"$PUPPET_TAGS\""
fi
TAGS="--tags \"$PUPPET_TAGS\""
fi
- # workaround LP1696283
- mkdir -p /etc/ssh
- touch /etc/ssh/ssh_known_hosts
+ # Create a reference timestamp to easily find all files touched by
+ # puppet. The sync ensures we get all the files we want due to
+ # different timestamp.
+ touch /tmp/the_origin_of_time
+ sync
FACTER_hostname=$HOSTNAME FACTER_uuid=docker /usr/bin/puppet apply --verbose $TAGS /etc/config.pp
# Disables archiving
if [ -z "$NO_ARCHIVE" ]; then
FACTER_hostname=$HOSTNAME FACTER_uuid=docker /usr/bin/puppet apply --verbose $TAGS /etc/config.pp
# Disables archiving
if [ -z "$NO_ARCHIVE" ]; then
- archivedirs=("/etc" "/root" "/var/lib/ironic/tftpboot" "/var/lib/ironic/httpboot" "/var/www")
+ archivedirs=("/etc" "/root" "/
opt" "/
var/lib/ironic/tftpboot" "/var/lib/ironic/httpboot" "/var/www")
rsync_srcs=""
for d in "${archivedirs[@]}"; do
if [ -d "$d" ]; then
rsync_srcs=""
for d in "${archivedirs[@]}"; do
if [ -d "$d" ]; then
@@
-212,12
+218,12
@@
def mp_puppet_config((config_volume, puppet_tags, manifest, config_image, volume
# This is useful for debugging
mkdir -p /var/lib/config-data/puppet-generated/${NAME}
rsync -a -R -0 --delay-updates --delete-after \
# This is useful for debugging
mkdir -p /var/lib/config-data/puppet-generated/${NAME}
rsync -a -R -0 --delay-updates --delete-after \
- --files-from=<(find $rsync_srcs -newer /
etc/ssh/ssh_known_hosts
-print0) \
+ --files-from=<(find $rsync_srcs -newer /
tmp/the_origin_of_time -not -path '/etc/puppet*'
-print0) \
/ /var/lib/config-data/puppet-generated/${NAME}
# Write a checksum of the config-data dir, this is used as a
# salt to trigger container restart when the config changes
/ /var/lib/config-data/puppet-generated/${NAME}
# Write a checksum of the config-data dir, this is used as a
# salt to trigger container restart when the config changes
- tar
cf - /var/lib/config-data/${NAME}
| md5sum | awk '{print $1}' > /var/lib/config-data/${NAME}.md5sum
+ tar
-c -f - /var/lib/config-data/${NAME} --mtime='1970-01-01'
| md5sum | awk '{print $1}' > /var/lib/config-data/${NAME}.md5sum
fi
""")
fi
""")
@@
-272,13
+278,17
@@
def mp_puppet_config((config_volume, puppet_tags, manifest, config_image, volume
subproc = subprocess.Popen(dcmd, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, env=env)
cmd_stdout, cmd_stderr = subproc.communicate()
subproc = subprocess.Popen(dcmd, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, env=env)
cmd_stdout, cmd_stderr = subproc.communicate()
- if cmd_stdout:
- log.debug(cmd_stdout)
- if cmd_stderr:
- log.debug(cmd_stderr)
if subproc.returncode != 0:
log.error('Failed running docker-puppet.py for %s' % config_volume)
if subproc.returncode != 0:
log.error('Failed running docker-puppet.py for %s' % config_volume)
+ if cmd_stdout:
+ log.error(cmd_stdout)
+ if cmd_stderr:
+ log.error(cmd_stderr)
else:
else:
+ if cmd_stdout:
+ log.debug(cmd_stdout)
+ if cmd_stderr:
+ log.debug(cmd_stderr)
# only delete successful runs, for debugging
rm_container('docker-puppet-%s' % config_volume)
return subproc.returncode
# only delete successful runs, for debugging
rm_container('docker-puppet-%s' % config_volume)
return subproc.returncode