aboutsummaryrefslogtreecommitdiffstats
path: root/cloudify/scripts/create.py
diff options
context:
space:
mode:
authorMarek Wolczanski <marek.wolczanski@cloudify.co>2017-10-03 14:55:19 +0200
committerMarek Wolczanski <marek.wolczanski@cloudify.co>2017-10-03 15:27:26 +0200
commit63f2cc936ed6e6790f287195694f6d067decdd89 (patch)
treee79b62b7fc3e099708b6707454b4c52ee3e581da /cloudify/scripts/create.py
parentb9644b17f8545dedd3ede40f778b33f9b4ecf480 (diff)
Cloudify support for OOM
Issue-ID: OOM-106 Change-Id: Ie0a37ef378fd1907825da181c81502c6fbe9134c Signed-off-by: Marek Wolczanski <marek.wolczanski@cloudify.co>
Diffstat (limited to 'cloudify/scripts/create.py')
-rw-r--r--cloudify/scripts/create.py72
1 files changed, 0 insertions, 72 deletions
diff --git a/cloudify/scripts/create.py b/cloudify/scripts/create.py
deleted file mode 100644
index eb362a4558..0000000000
--- a/cloudify/scripts/create.py
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/usr/bin/env python
-
-import subprocess
-from cloudify import ctx
-from cloudify.exceptions import OperationRetry
-
-
-def check_command(command):
-
- try:
- process = subprocess.Popen(
- command.split()
- )
- except OSError:
- return False
-
- output, error = process.communicate()
-
- ctx.logger.debug('command: {0} '.format(command))
- ctx.logger.debug('output: {0} '.format(output))
- ctx.logger.debug('error: {0} '.format(error))
- ctx.logger.debug('process.returncode: {0} '.format(process.returncode))
-
- if process.returncode:
- ctx.logger.error('Running `{0}` returns error.'.format(command))
- return False
-
- return True
-
-
-def execute_command(_command):
-
- ctx.logger.debug('_command {0}.'.format(_command))
-
- subprocess_args = {
- 'args': _command.split(),
- 'stdout': subprocess.PIPE,
- 'stderr': subprocess.PIPE
- }
-
- ctx.logger.debug('subprocess_args {0}.'.format(subprocess_args))
-
- process = subprocess.Popen(**subprocess_args)
- output, error = process.communicate()
-
- ctx.logger.debug('command: {0} '.format(_command))
- ctx.logger.debug('output: {0} '.format(output))
- ctx.logger.debug('error: {0} '.format(error))
- ctx.logger.debug('process.returncode: {0} '.format(process.returncode))
-
- if process.returncode:
- ctx.logger.error('Running `{0}` returns error.'.format(_command))
- return False
-
- return output
-
-
-if __name__ == '__main__':
-
- docker_command = 'docker ps'
-
- if not check_command(docker_command):
- raise OperationRetry('Waiting for docker to be installed.')
-
- finished = False
- ps = execute_command('ps -ef')
- for line in ps.split('\n'):
- if '/usr/bin/python /usr/bin/cloud-init modules' in line:
- ctx.logger.error('in line')
- raise OperationRetry('Waiting for Cloud Init to finish.')
-
- ctx.logger.info('Docker is ready and Cloud Init finished.')