Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

Commit

Permalink
Revert "Mock EC2 metadata: make service persist across reboots"
Browse files Browse the repository at this point in the history
This reverts commit 8a9ac69.
  • Loading branch information
rtrinque committed Jul 20, 2018
1 parent 928a9e6 commit 001d70a
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions tools/vagrant/mock-ec2-metadata-service.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import sys
import time
import json
import shutil

REGION = 'eu-west-1'
IMAGE_IDS = {
Expand Down Expand Up @@ -117,18 +116,6 @@ def daemonize():
sys.exit("Fork #2 failed: {0} ({1})".format(e.errno, e.strerror))


def persist():
shutil.copy(__file__, '/usr/local/bin/mock-ec2-metadata-service.py')
with open('/etc/init/mock-ec2-metadata.conf', 'w') as upstart:
upstart.write(str.join("\n", [
'description "Mock EC2 Metadata"',
'start on runlevel [2345]',
'stop on runlevel [!2345]',
'exec /usr/local/bin/mock-ec2-metadata-service.py',
]))
upstart.write("\n")
upstart.close()

def assume_169254_address():
try:
loopback_config = subprocess.check_output(['ip', 'addr', 'show', 'dev', 'lo']).decode('utf-8')
Expand Down Expand Up @@ -164,7 +151,6 @@ def assume_169254_address():

if os.getenv('FG_ONLY') is None:
daemonize()
persist()

print("Mock EC2 metadata service ready", file=sys.stderr)
httpd.serve_forever()

0 comments on commit 001d70a

Please sign in to comment.