Skip to content

Commit

Permalink
Merge pull request #7 from apls777/spotty
Browse files Browse the repository at this point in the history
fix for apt lock
  • Loading branch information
apls777 authored Sep 8, 2018
2 parents 9ea4897 + cce4fc9 commit 2b1d6a2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion spotty/commands/delete_ami.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def run(self, output: AbstractOutputWriter):

# check that only one image with such name exists
if not len(res['Images']):
raise ValueError('Image with Name=%s not found.' % ami_name)
raise ValueError('AMI with name "%s" not found.' % ami_name)
elif len(res['Images']) > 1:
raise ValueError('Several images with Name=%s found.' % ami_name)

Expand Down
10 changes: 10 additions & 0 deletions spotty/data/create_ami.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ Resources:
'Fn::Base64': !Sub |
#!/bin/bash -x

# stop daily updates for apt (fix for the issue when the cloud-init fails to install packages
# because the "/var/lib/dpkg/lock" file is locked)
systemctl disable --now apt-daily{,-upgrade}.{timer,service}

# install CloudFormation tools
apt-get update
apt-get -y install python-setuptools
Expand Down Expand Up @@ -249,6 +253,12 @@ Resources:
log_group_name = ${InstanceLogGroup}
log_stream_name = {instance_id}/cfn-init.log
datetime_format = %d/%b/%Y:%H:%M:%S
[/var/log/cfn-init-cmd.log]
file = /var/log/cfn-init-cmd.log
log_group_name = ${InstanceLogGroup}
log_stream_name = {instance_id}/cfn-init-cmd.log
datetime_format = %d/%b/%Y:%H:%M:%S
mode: '000400'
owner: root
group: root
Expand Down
10 changes: 8 additions & 2 deletions spotty/data/run_container.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,12 @@ Resources:
log_stream_name = {instance_id}/cfn-init.log
datetime_format = %d/%b/%Y:%H:%M:%S
[/var/log/cfn-init-cmd.log]
file = /var/log/cfn-init-cmd.log
log_group_name = ${InstanceLogGroup}
log_stream_name = {instance_id}/cfn-init-cmd.log
datetime_format = %d/%b/%Y:%H:%M:%S
[/var/log/cfn-hup.log]
file = /var/log/cfn-hup.log
log_group_name = ${SpotInstanceLogGroup}
Expand Down Expand Up @@ -184,7 +190,7 @@ Resources:
mkdir -p /var/log/spotty-run
chmod 777 /var/log/spotty-run
commands:
mount_volume:
prepare_instance:
command: '/bin/bash -xe /tmp/scripts/prepare_instance.sh'
mount_volumes_config:
files:
Expand Down Expand Up @@ -221,7 +227,7 @@ Resources:
aws s3 sync s3://${ProjectS3Bucket}/project ${ProjectDirectory}
fi
commands:
mount_volume:
sync_project:
command: '/bin/bash -xe /tmp/scripts/sync_project.sh'
docker_container_config:
files:
Expand Down

0 comments on commit 2b1d6a2

Please sign in to comment.