print() if not ready: raise Exception("Server nodes failed to become healthy!") if __name__ == "__main__": parser = ArgumentParser(prog="install_couchbase_server") config = Configuration() config.load() parser.add_argument("keyname", action="store", type=str, help="The name of the SSH key that the EC2 instances are using") parser.add_argument("--region", action="store", type=str, dest="region", default=config.get(SettingKeyNames.AWS_REGION), help="The EC2 region to query (default %(default)s)") parser.add_argument("--server-name-prefix", action="store", type=str, dest="servername", default=config.get(SettingKeyNames.CBS_SERVER_PREFIX), help="The name of the server to use to reset the Couchbase cluster (default %(default)s)") parser.add_argument("--ssh-key", action="store", type=str, dest="sshkey", help="The key to connect to EC2 instances") parser.add_argument("--setup-only", action="store_true", dest="setuponly", help="Skip the program installation, and configure only") parser.add_argument("--username", action="store", default=config.get(SettingKeyNames.CBS_ADMIN), help="The administrator username for Couchbase Server (default %(default)s)") parser.add_argument("--password", action="store", help="The administrator password for Couchbase Server (If not provided, " + "run credential.py for information on how it is resolved)") args = parser.parse_args()
type=int, dest="num_sync_gateways", default=0, help="number of sync_gateway instances") parser.add_argument( "--sync-gateway-type", action="store", type=str, dest="sync_gateway_type", default="m3.medium", help="EC2 instance type for sync_gateway type (default: %(default)s)") parser.add_argument("--region", action="store", type=str, dest="region", default=config.get(SettingKeyNames.AWS_REGION), help="The AWS region to use (default: %(default)s)") parser.add_argument( "--server-prefix", action="store", type=str, dest="serverprefix", default=config.get(SettingKeyNames.CBS_SERVER_PREFIX), help= "The prefix to use when naming EC2 instances for Couchbase Server (default: %(default)s)" ) parser.add_argument( "--sync-gateway-prefix", action="store", type=str, dest="sgprefix",
print("Found the following running instances to stop: {}".format(list(str(i) for i in instances))) ec2 = boto3.client("ec2", region_name=region) return ec2.stop_instances(InstanceIds=instances_ids) if __name__ == "__main__": parser = ArgumentParser() config = Configuration() config.load() parser.add_argument("keyname", action="store", type=str, help="The name of the SSH key that the EC2 instances are using") parser.add_argument("state", action="store", type=lambda s: AWSState[s], choices=list(AWSState), help="The state to set the cluster into") parser.add_argument("--region", action="store", type=str, dest="region", default=config.get(SettingKeyNames.AWS_REGION), help="The EC2 region (default %(default)s)") args = parser.parse_args() if args.state == AWSState.STOPPED: instances = get_aws_instances(AWSState.RUNNING, args.keyname, args.region) else: instances = get_aws_instances(AWSState.STOPPED, args.keyname, args.region) if len(instances) == 0: print("No instances found that need changing!") sys.exit(0) if args.state == AWSState.STOPPED: result = stop_cluster(instances, args.region) else:
parser.add_argument( "keyname", action="store", type=str, help="The name of the SSH key that the EC2 instances are using") parser.add_argument("state", action="store", type=lambda s: AWSState[s], choices=list(AWSState), help="The state of the instances to be found") parser.add_argument("--region", action="store", type=str, dest="region", default=config.get(SettingKeyNames.AWS_REGION), help="The EC2 region to query (default %(default)s)") args = parser.parse_args() instances = get_aws_instances(args.state, args.keyname, args.region) if len(instances) == 0: print("No instances found!") sys.exit(0) print() print("Found the following instances:") print() if args.state == AWSState.STOPPED: columns = ["Name", "Id"] data = list([x.name, x.id] for x in instances) print(tabulate(data, headers=columns))
type=str, help="The name of the SSH key that the EC2 instances are using") parser.add_argument("project_name", action="store", type=str, help="The name of the device farm project to run") parser.add_argument("platform", action="store", type=lambda s: AppType[str.upper(s)], choices=list(AppType), help="The platform to run the test on") parser.add_argument("--region", action="store", type=str, dest="region", default=config.get(SettingKeyNames.AWS_REGION), help="The EC2 region to query (default %(default)s)") parser.add_argument( "--sg-name-prefix", action="store", type=str, dest="sgname", default=config.get(SettingKeyNames.SG_SERVER_PREFIX), help= "The prefix of the Sync Gateway instance names in EC2 (default %(default)s)" ) parser.add_argument("--skip-s3-upload", action="store_true", dest="skipupload", help="If set, don't upload the SG address to S3") parser.add_argument(