| 103 | |
| 104 | |
| 105 | def validate_instance(params): |
| 106 | if platform.system() == 'Linux': |
| 107 | distribution = awscli.compat.linux_distribution()[0] |
| 108 | if 'Ubuntu' in distribution: |
| 109 | params.system = Ubuntu(params) |
| 110 | if 'Red Hat Enterprise Linux Server' in distribution: |
| 111 | params.system = RHEL(params) |
| 112 | elif platform.system() == 'Windows': |
| 113 | params.system = Windows(params) |
| 114 | if 'system' not in params: |
| 115 | raise RuntimeError(System.UNSUPPORTED_SYSTEM_MSG) |
| 116 | try: |
| 117 | urlopen('http://169.254.169.254/latest/meta-data/', timeout=1) |
| 118 | raise RuntimeError('Amazon EC2 instances are not supported.') |
| 119 | except (URLError, timeout): |
| 120 | pass |
| 121 | |
| 122 | |
| 123 | def validate_s3_location(params, arg_name): |