Repository: aws-cloudformation/cfn-lint

Issue:
AWS::Serverless::Api Cors config transform error
#### cfn-lint version:
``` console
$ cfn-lint --version
cfn-lint 0.8.3
```

#### Description of issue:
When I have a `AWS::Serverless::Api` object with a [Cors Configuration](https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#cors-configuration) object in it I routinely get the following error when linting `template.yaml` 

`E0001 Error transforming template: 'dict_node' object has no attribute 'start_mark'`

I also got the following stack trace when running 
```
Traceback (most recent call last):
  File "/usr/local/bin/cfn-lint", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/site-packages/cfnlint/__main__.py", line 36, in main
    args.regions, args.override_spec))
  File "/usr/local/lib/python2.7/site-packages/cfnlint/core.py", line 46, in run_cli
    return run_checks(filename, template, rules, regions)
  File "/usr/local/lib/python2.7/site-packages/cfnlint/core.py", line 316, in run_checks
    matches.extend(runner.transform())
  File "/usr/local/lib/python2.7/site-packages/cfnlint/__init__.py", line 894, in transform
    matches = transform.transform_template()
  File "/usr/local/lib/python2.7/site-packages/cfnlint/transform.py", line 115, in transform_template
    sam_translator.translate(sam_template=self._template, parameter_values={}))
  File "/Users/eaddingtonwhite/Library/Python/2.7/lib/python/site-packages/samtranslator/translator/translator.py", line 71, in translate
    translated = macro.to_cloudformation(**kwargs)
  File "/Users/eaddingtonwhite/Library/Python/2.7/lib/python/site-packages/samtranslator/model/sam_resources.py", line 501, in to_cloudformation
    rest_api, deployment, stage = api_generator.to_cloudformation()
  File "/Users/eaddingtonwhite/Library/Python/2.7/lib/python/site-packages/samtranslator/model/api/api_generator.py", line 160, in to_cloudformation
    rest_api = self._construct_rest_api()
  File "/Users/eaddingtonwhite/Library/Python/2.7/lib/python/site-packages/samtranslator/model/api/api_generator.py", line 69, in _construct_rest_api
    self._add_cors()
  File "/Users/eaddingtonwhite/Library/Python/2.7/lib/python/site-packages/samtranslator/model/api/api_generator.py", line 212, in _add_cors
    self.definition_body = editor.swagger
  File "/Users/eaddingtonwhite/Library/Python/2.7/lib/python/site-packages/samtranslator/swagger/swagger.py", line 298, in swagger
    return copy.deepcopy(self._doc)
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/copy.py", line 174, in deepcopy
    y = copier(memo)
  File "/usr/local/lib/python2.7/site-packages/cfnlint/decode/node.py", line 75, in __deepcopy__
    result = cls.__new__(cls, self.start_mark, self.end_mark)
AttributeError: 'dict_node' object has no attribute 'start_mark'
```
Here is simple example I made to reproduce
```yaml
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31

Resources:
  Function:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: hello_world/
      Handler: app.lambda_handler
      Runtime: nodejs8.10

  Api:
    Type: AWS::Serverless::Api
    Properties:
      Name: test
      StageName: test
      Cors:
        AllowHeaders: "'my_custom_header,content-type'"
        AllowOrigin: "'*'"
        MaxAge: ""
      DefinitionBody:
        swagger: "2.0"
        info:
          version: "1.0"
          title: "test"
        basePath: "/"
        schemes:
          - "https"
        paths:
          /:
            get:
              x-amazon-apigateway-integration:
                uri:
                  Fn::Sub: "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${Function.Arn}/invocations"
                passthroughBehavior: "when_no_match"
                httpMethod: "POST"
                type: "aws_proxy"
```

If you comment out the following lines then issue goes away:
```yaml
      Cors:
        AllowHeaders: "'my_custom_header,content-type'"
        AllowOrigin: "'*'"
        MaxAge: ""
```


Discussion:
Confirmed.  I'm working on it.

Resolving patch:
diff --git a/src/cfnlint/decode/node.py b/src/cfnlint/decode/node.py
--- a/src/cfnlint/decode/node.py
+++ b/src/cfnlint/decode/node.py
@@ -81,8 +81,7 @@ def __init__(self, x, start_mark, end_mark):
             self.condition_functions = ['Fn::If']
 
         def __deepcopy__(self, memo):
-            cls = self.__class__
-            result = cls.__new__(cls, self.start_mark, self.end_mark)
+            result = dict_node(self, self.start_mark, self.end_mark)
             memo[id(self)] = result
             for k, v in self.items():
                 result[deepcopy(k)] = deepcopy(v, memo)
@@ -160,8 +159,7 @@ def __init__(self, x, start_mark, end_mark):
             self.condition_functions = ['Fn::If']
 
         def __deepcopy__(self, memo):
-            cls = self.__class__
-            result = cls.__new__(cls, self.start_mark, self.end_mark)
+            result = list_node([], self.start_mark, self.end_mark)
             memo[id(self)] = result
             for _, v in enumerate(self):
                 result.append(deepcopy(v, memo))


Test patch: