Change whitespaces back to the way they were and fix typos

This commit is contained in:
Stephan Huber 2020-01-23 15:46:50 +01:00
parent 84210f6011
commit 20020c5170
2 changed files with 262 additions and 262 deletions

View File

@ -97,7 +97,7 @@ class FakeThingGroup(BaseModel):
break break
# if parent arn found (should always be found) # if parent arn found (should always be found)
if parent_thing_group_structure: if parent_thing_group_structure:
# copy parent"s rootToParentThingGroups # copy parent's rootToParentThingGroups
if "rootToParentThingGroups" in parent_thing_group_structure.metadata: if "rootToParentThingGroups" in parent_thing_group_structure.metadata:
self.metadata["rootToParentThingGroups"].extend( self.metadata["rootToParentThingGroups"].extend(
parent_thing_group_structure.metadata["rootToParentThingGroups"] parent_thing_group_structure.metadata["rootToParentThingGroups"]
@ -424,7 +424,7 @@ class IoTBackend(BaseBackend):
def list_thing_types(self, thing_type_name=None): def list_thing_types(self, thing_type_name=None):
if thing_type_name: if thing_type_name:
# It"s weird but thing_type_name is filtered by forward match, not complete match # It's weird but thing_type_name is filtered by forward match, not complete match
return [ return [
_ _
for _ in self.thing_types.values() for _ in self.thing_types.values()

View File

@ -1,260 +1,260 @@
from __future__ import unicode_literals from __future__ import unicode_literals
template = { template = {
"Description": "AWS CloudFormation Sample Template Gollum_Single_Instance_With_EBS_Volume: Gollum is a simple wiki system built on top of Git that powers GitHub Wikis. This template installs a Gollum Wiki stack on a single EC2 instance with an EBS volume for storage and demonstrates using the AWS CloudFormation bootstrap scripts to install the packages and files necessary at instance launch time. **WARNING** This template creates an Amazon EC2 instance and an EBS volume. You will be billed for the AWS resources used if you create a stack from this template.", "Description": "AWS CloudFormation Sample Template Gollum_Single_Instance_With_EBS_Volume: Gollum is a simple wiki system built on top of Git that powers GitHub Wikis. This template installs a Gollum Wiki stack on a single EC2 instance with an EBS volume for storage and demonstrates using the AWS CloudFormation bootstrap scripts to install the packages and files necessary at instance launch time. **WARNING** This template creates an Amazon EC2 instance and an EBS volume. You will be billed for the AWS resources used if you create a stack from this template.",
"Parameters": { "Parameters": {
"SSHLocation": { "SSHLocation": {
"ConstraintDescription": "must be a valid IP CIDR range of the form x.x.x.x/x.", "ConstraintDescription": "must be a valid IP CIDR range of the form x.x.x.x/x.",
"Description": "The IP address range that can be used to SSH to the EC2 instances", "Description": "The IP address range that can be used to SSH to the EC2 instances",
"Default": "0.0.0.0/0", "Default": "0.0.0.0/0",
"MinLength": "9", "MinLength": "9",
"AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})", "AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})",
"MaxLength": "18", "MaxLength": "18",
"Type": "String", "Type": "String",
}, },
"KeyName": { "KeyName": {
"Type": "String", "Type": "String",
"Description": "Name of an existing EC2 KeyPair to enable SSH access to the instances", "Description": "Name of an existing EC2 KeyPair to enable SSH access to the instances",
"MinLength": "1", "MinLength": "1",
"AllowedPattern": "[\\x20-\\x7E]*", "AllowedPattern": "[\\x20-\\x7E]*",
"MaxLength": "255", "MaxLength": "255",
"ConstraintDescription": "can contain only ASCII characters.", "ConstraintDescription": "can contain only ASCII characters.",
}, },
"InstanceType": { "InstanceType": {
"Default": "m1.small", "Default": "m1.small",
"ConstraintDescription": "must be a valid EC2 instance type.", "ConstraintDescription": "must be a valid EC2 instance type.",
"Type": "String", "Type": "String",
"Description": "WebServer EC2 instance type", "Description": "WebServer EC2 instance type",
"AllowedValues": [ "AllowedValues": [
"t1.micro", "t1.micro",
"m1.small", "m1.small",
"m1.medium", "m1.medium",
"m1.large", "m1.large",
"m1.xlarge", "m1.xlarge",
"m2.xlarge", "m2.xlarge",
"m2.2xlarge", "m2.2xlarge",
"m2.4xlarge", "m2.4xlarge",
"m3.xlarge", "m3.xlarge",
"m3.2xlarge", "m3.2xlarge",
"c1.medium", "c1.medium",
"c1.xlarge", "c1.xlarge",
"cc1.4xlarge", "cc1.4xlarge",
"cc2.8xlarge", "cc2.8xlarge",
"cg1.4xlarge", "cg1.4xlarge",
], ],
}, },
"VolumeSize": { "VolumeSize": {
"Description": "WebServer EC2 instance type", "Description": "WebServer EC2 instance type",
"Default": "5", "Default": "5",
"Type": "Number", "Type": "Number",
"MaxValue": "1024", "MaxValue": "1024",
"MinValue": "5", "MinValue": "5",
"ConstraintDescription": "must be between 5 and 1024 Gb.", "ConstraintDescription": "must be between 5 and 1024 Gb.",
}, },
}, },
"AWSTemplateFormatVersion": "2010-09-09", "AWSTemplateFormatVersion": "2010-09-09",
"Outputs": { "Outputs": {
"WebsiteURL": { "WebsiteURL": {
"Description": "URL for Gollum wiki", "Description": "URL for Gollum wiki",
"Value": { "Value": {
"Fn::Join": [ "Fn::Join": [
"", "",
["http://", {"Fn::GetAtt": ["WebServer", "PublicDnsName"]}], ["http://", {"Fn::GetAtt": ["WebServer", "PublicDnsName"]}],
] ]
}, },
} }
}, },
"Resources": { "Resources": {
"WebServerSecurityGroup": { "WebServerSecurityGroup": {
"Type": "AWS::EC2::SecurityGroup", "Type": "AWS::EC2::SecurityGroup",
"Properties": { "Properties": {
"SecurityGroupIngress": [ "SecurityGroupIngress": [
{ {
"ToPort": "80", "ToPort": "80",
"IpProtocol": "tcp", "IpProtocol": "tcp",
"CidrIp": "0.0.0.0/0", "CidrIp": "0.0.0.0/0",
"FromPort": "80", "FromPort": "80",
}, },
{ {
"ToPort": "22", "ToPort": "22",
"IpProtocol": "tcp", "IpProtocol": "tcp",
"CidrIp": {"Ref": "SSHLocation"}, "CidrIp": {"Ref": "SSHLocation"},
"FromPort": "22", "FromPort": "22",
}, },
], ],
"GroupDescription": "Enable SSH access and HTTP access on the inbound port", "GroupDescription": "Enable SSH access and HTTP access on the inbound port",
}, },
}, },
"WebServer": { "WebServer": {
"Type": "AWS::EC2::Instance", "Type": "AWS::EC2::Instance",
"Properties": { "Properties": {
"UserData": { "UserData": {
"Fn::Base64": { "Fn::Base64": {
"Fn::Join": [ "Fn::Join": [
"", "",
[ [
"#!/bin/bash -v\n", "#!/bin/bash -v\n",
"yum update -y aws-cfn-bootstrap\n", "yum update -y aws-cfn-bootstrap\n",
"# Helper function\n", "# Helper function\n",
"function error_exit\n", "function error_exit\n",
"{\n", "{\n",
' /opt/aws/bin/cfn-signal -e 1 -r "$1" \'', ' /opt/aws/bin/cfn-signal -e 1 -r "$1" \'',
{"Ref": "WaitHandle"}, {"Ref": "WaitHandle"},
"'\n", "'\n",
" exit 1\n", " exit 1\n",
"}\n", "}\n",
"# Install Rails packages\n", "# Install Rails packages\n",
"/opt/aws/bin/cfn-init -s ", "/opt/aws/bin/cfn-init -s ",
{"Ref": "AWS::StackId"}, {"Ref": "AWS::StackId"},
" -r WebServer ", " -r WebServer ",
" --region ", " --region ",
{"Ref": "AWS::Region"}, {"Ref": "AWS::Region"},
" || error_exit 'Failed to run cfn-init'\n", " || error_exit 'Failed to run cfn-init'\n",
"# Wait for the EBS volume to show up\n", "# Wait for the EBS volume to show up\n",
"while [ ! -e /dev/sdh ]; do echo Waiting for EBS volume to attach; sleep 5; done\n", "while [ ! -e /dev/sdh ]; do echo Waiting for EBS volume to attach; sleep 5; done\n",
"# Format the EBS volume and mount it\n", "# Format the EBS volume and mount it\n",
"mkdir /var/wikidata\n", "mkdir /var/wikidata\n",
"/sbin/mkfs -t ext3 /dev/sdh1\n", "/sbin/mkfs -t ext3 /dev/sdh1\n",
"mount /dev/sdh1 /var/wikidata\n", "mount /dev/sdh1 /var/wikidata\n",
"# Initialize the wiki and fire up the server\n", "# Initialize the wiki and fire up the server\n",
"cd /var/wikidata\n", "cd /var/wikidata\n",
"git init\n", "git init\n",
"gollum --port 80 --host 0.0.0.0 &\n", "gollum --port 80 --host 0.0.0.0 &\n",
"# If all is well so signal success\n", "# If all is well so signal success\n",
'/opt/aws/bin/cfn-signal -e $? -r "Rails application setup complete" \'', '/opt/aws/bin/cfn-signal -e $? -r "Rails application setup complete" \'',
{"Ref": "WaitHandle"}, {"Ref": "WaitHandle"},
"'\n", "'\n",
], ],
] ]
} }
}, },
"KeyName": {"Ref": "KeyName"}, "KeyName": {"Ref": "KeyName"},
"SecurityGroups": [{"Ref": "WebServerSecurityGroup"}], "SecurityGroups": [{"Ref": "WebServerSecurityGroup"}],
"InstanceType": {"Ref": "InstanceType"}, "InstanceType": {"Ref": "InstanceType"},
"ImageId": { "ImageId": {
"Fn::FindInMap": [ "Fn::FindInMap": [
"AWSRegionArch2AMI", "AWSRegionArch2AMI",
{"Ref": "AWS::Region"}, {"Ref": "AWS::Region"},
{ {
"Fn::FindInMap": [ "Fn::FindInMap": [
"AWSInstanceType2Arch", "AWSInstanceType2Arch",
{"Ref": "InstanceType"}, {"Ref": "InstanceType"},
"Arch", "Arch",
] ]
}, },
] ]
}, },
}, },
"Metadata": { "Metadata": {
"AWS::CloudFormation::Init": { "AWS::CloudFormation::Init": {
"config": { "config": {
"packages": { "packages": {
"rubygems": { "rubygems": {
"nokogiri": ["1.5.10"], "nokogiri": ["1.5.10"],
"rdiscount": [], "rdiscount": [],
"gollum": ["1.1.1"], "gollum": ["1.1.1"],
}, },
"yum": { "yum": {
"libxslt-devel": [], "libxslt-devel": [],
"gcc": [], "gcc": [],
"git": [], "git": [],
"rubygems": [], "rubygems": [],
"ruby-devel": [], "ruby-devel": [],
"ruby-rdoc": [], "ruby-rdoc": [],
"make": [], "make": [],
"libxml2-devel": [], "libxml2-devel": [],
}, },
} }
} }
} }
}, },
}, },
"DataVolume": { "DataVolume": {
"Type": "AWS::EC2::Volume", "Type": "AWS::EC2::Volume",
"Properties": { "Properties": {
"Tags": [{"Value": "Gollum Data Volume", "Key": "Usage"}], "Tags": [{"Value": "Gollum Data Volume", "Key": "Usage"}],
"AvailabilityZone": {"Fn::GetAtt": ["WebServer", "AvailabilityZone"]}, "AvailabilityZone": {"Fn::GetAtt": ["WebServer", "AvailabilityZone"]},
"Size": "100", "Size": "100",
}, },
}, },
"MountPoint": { "MountPoint": {
"Type": "AWS::EC2::VolumeAttachment", "Type": "AWS::EC2::VolumeAttachment",
"Properties": { "Properties": {
"InstanceId": {"Ref": "WebServer"}, "InstanceId": {"Ref": "WebServer"},
"Device": "/dev/sdh", "Device": "/dev/sdh",
"VolumeId": {"Ref": "DataVolume"}, "VolumeId": {"Ref": "DataVolume"},
}, },
}, },
"WaitCondition": { "WaitCondition": {
"DependsOn": "MountPoint", "DependsOn": "MountPoint",
"Type": "AWS::CloudFormation::WaitCondition", "Type": "AWS::CloudFormation::WaitCondition",
"Properties": {"Handle": {"Ref": "WaitHandle"}, "Timeout": "300"}, "Properties": {"Handle": {"Ref": "WaitHandle"}, "Timeout": "300"},
"Metadata": { "Metadata": {
"Comment1": "Note that the WaitCondition is dependent on the volume mount point allowing the volume to be created and attached to the EC2 instance", "Comment1": "Note that the WaitCondition is dependent on the volume mount point allowing the volume to be created and attached to the EC2 instance",
"Comment2": "The instance bootstrap script waits for the volume to be attached to the instance prior to installing Gollum and signalling completion", "Comment2": "The instance bootstrap script waits for the volume to be attached to the instance prior to installing Gollum and signalling completion",
}, },
}, },
"WaitHandle": {"Type": "AWS::CloudFormation::WaitConditionHandle"}, "WaitHandle": {"Type": "AWS::CloudFormation::WaitConditionHandle"},
}, },
"Mappings": { "Mappings": {
"AWSInstanceType2Arch": { "AWSInstanceType2Arch": {
"m3.2xlarge": {"Arch": "64"}, "m3.2xlarge": {"Arch": "64"},
"m2.2xlarge": {"Arch": "64"}, "m2.2xlarge": {"Arch": "64"},
"m1.small": {"Arch": "64"}, "m1.small": {"Arch": "64"},
"c1.medium": {"Arch": "64"}, "c1.medium": {"Arch": "64"},
"cg1.4xlarge": {"Arch": "64HVM"}, "cg1.4xlarge": {"Arch": "64HVM"},
"m2.xlarge": {"Arch": "64"}, "m2.xlarge": {"Arch": "64"},
"t1.micro": {"Arch": "64"}, "t1.micro": {"Arch": "64"},
"cc1.4xlarge": {"Arch": "64HVM"}, "cc1.4xlarge": {"Arch": "64HVM"},
"m1.medium": {"Arch": "64"}, "m1.medium": {"Arch": "64"},
"cc2.8xlarge": {"Arch": "64HVM"}, "cc2.8xlarge": {"Arch": "64HVM"},
"m1.large": {"Arch": "64"}, "m1.large": {"Arch": "64"},
"m1.xlarge": {"Arch": "64"}, "m1.xlarge": {"Arch": "64"},
"m2.4xlarge": {"Arch": "64"}, "m2.4xlarge": {"Arch": "64"},
"c1.xlarge": {"Arch": "64"}, "c1.xlarge": {"Arch": "64"},
"m3.xlarge": {"Arch": "64"}, "m3.xlarge": {"Arch": "64"},
}, },
"AWSRegionArch2AMI": { "AWSRegionArch2AMI": {
"ap-southeast-1": { "ap-southeast-1": {
"64HVM": "NOT_YET_SUPPORTED", "64HVM": "NOT_YET_SUPPORTED",
"32": "ami-b4b0cae6", "32": "ami-b4b0cae6",
"64": "ami-beb0caec", "64": "ami-beb0caec",
}, },
"ap-southeast-2": { "ap-southeast-2": {
"64HVM": "NOT_YET_SUPPORTED", "64HVM": "NOT_YET_SUPPORTED",
"32": "ami-b3990e89", "32": "ami-b3990e89",
"64": "ami-bd990e87", "64": "ami-bd990e87",
}, },
"us-west-2": { "us-west-2": {
"64HVM": "NOT_YET_SUPPORTED", "64HVM": "NOT_YET_SUPPORTED",
"32": "ami-38fe7308", "32": "ami-38fe7308",
"64": "ami-30fe7300", "64": "ami-30fe7300",
}, },
"us-east-1": { "us-east-1": {
"64HVM": "ami-0da96764", "64HVM": "ami-0da96764",
"32": "ami-31814f58", "32": "ami-31814f58",
"64": "ami-1b814f72", "64": "ami-1b814f72",
}, },
"ap-northeast-1": { "ap-northeast-1": {
"64HVM": "NOT_YET_SUPPORTED", "64HVM": "NOT_YET_SUPPORTED",
"32": "ami-0644f007", "32": "ami-0644f007",
"64": "ami-0a44f00b", "64": "ami-0a44f00b",
}, },
"us-west-1": { "us-west-1": {
"64HVM": "NOT_YET_SUPPORTED", "64HVM": "NOT_YET_SUPPORTED",
"32": "ami-11d68a54", "32": "ami-11d68a54",
"64": "ami-1bd68a5e", "64": "ami-1bd68a5e",
}, },
"eu-west-1": { "eu-west-1": {
"64HVM": "NOT_YET_SUPPORTED", "64HVM": "NOT_YET_SUPPORTED",
"32": "ami-973b06e3", "32": "ami-973b06e3",
"64": "ami-953b06e1", "64": "ami-953b06e1",
}, },
"sa-east-1": { "sa-east-1": {
"64HVM": "NOT_YET_SUPPORTED", "64HVM": "NOT_YET_SUPPORTED",
"32": "ami-3e3be423", "32": "ami-3e3be423",
"64": "ami-3c3be421", "64": "ami-3c3be421",
}, },
}, },
}, },
} }