from tyr.servers.server import Server
import chef
import requests
import time
import os.path

class NginxServer(Server):

    SERVER_TYPE = 'nginx'

    CHEF_RUNLIST=['role[RoleNginx]']


    IAM_ROLE_POLICIES = [
        'allow-describe-instances',
        'allow-describe-tags',
        'allow-describe-elbs',
        'allow-get-nginx-config'
    ]

    def __init__(self, group=None, server_type=None, instance_type=None,
                    environment=None, ami=None, region=None, role=None,
                    keypair=None, availability_zone=None, security_groups=None,
                    block_devices=None, chef_path=None):

        if server_type is None: server_type = self.SERVER_TYPE

        super(NginxServer, self).__init__(group, server_type, instance_type,
                                    environment, ami, region, role,
                                    keypair, availability_zone,
                                    security_groups, chef_path)

    def configure(self):

        super(NginxServer, self).configure()

        if self.environment == 'stage':
            self.IAM_ROLE_POLICIES.append('allow-modify-nginx-elbs-stage')
        elif self.environment == 'prod':
            self.IAM_ROLE_POLICIES.append('allow-modify-nginx-elbs-prod')
        self.resolve_iam_role()

@@ -624,16 +624,32 @@
 ath=None
+, subnet_id=None
 ):%0A%0A    
@@ -970,25 +970,87 @@
 groups, 
-chef_path
+block_devices,%0A                                    chef_path, subnet_id
 )%0A%0A    d

add vpc support to nginx spin up