#!/usr/bin/env python
"""Docstring for module."""

import sys
import argparse
import os
from elementbase import ElementBase
# ==============================================================================
__version__ = "0.1"

__copyright__ = "Copyright 2017, devops.center"
__credits__ = ["Bob Lozano", "Gregg Jensen"]
__license__ = ' \
   # Copyright 2014-2017 devops.center llc                                    \
   #                                                                          \
   # Licensed under the Apache License, Version 2.0 (the "License");          \
   # you may not use this file except in compliance with the License.         \
   # You may obtain a copy of the License at                                  \
   #                                                                          \
   #   http://www.apache.org/licenses/LICENSE-2.0                             \
   #                                                                          \
   # Unless required by applicable law or agreed to in writing, software      \
   # distributed under the License is distributed on an "AS IS" BASIS,        \
   # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. \
   # See the License for the specific language governing permissions and      \
   # limitations under the License.                                           \
   # '
__status__ = "Development"
# ==============================================================================


class Web(ElementBase):
    """Class the installs the web components."""

    def __init__(self, argList):
        """Constructor for this class."""
        ElementBase.__init__(self, "web", argList)
        self.executePath = (self.stackDir + "/"
                            + self.stack + "-stack/web")
        self.executeScript = "sudo ./web.sh " + self.region

    def run(self):
        """Run the element to install the corresponding code."""
        # change directory to the dcStack buildtools directory to get the base
        # stuff to install
        currentDir = os.getcwd()
        theDir = os.path.expanduser(self.executePath)
        os.chdir(theDir)
        self.runScript(self.executeScript)

        # run the deployenv script
        self.runDeployEnv()

        # and move back to the original directory
        os.chdir(currentDir)

    def runDeployEnv(self):
        """Execute the deployEnv.sh script on the instance."""
        theDir = os.path.expanduser("~/dcUtils")

        self.runScript(theDir + "/deployenv.sh --type instance --env "
                       + self.env + " --appName " + self.appName)


def checkArgs():
    """Check the command line arguments."""
    parser = argparse.ArgumentParser(
        description=('comment'))
    parser.parse_args()


def main(argv):
    """Main code goes here."""
    checkArgs()


if __name__ == "__main__":
    main(sys.argv[1:])

# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4

@@ -2203,72 +2203,8 @@
 t)%0A%0A
-        # run the deployenv script%0A        self.runDeployEnv()%0A%0A
     
@@ -2283,287 +2283,8 @@
 r)%0A%0A
-    def runDeployEnv(self):%0A        %22%22%22Execute the deployEnv.sh script on the instance.%22%22%22%0A        theDir = os.path.expanduser(%22~/dcUtils%22)%0A%0A        self.runScript(theDir + %22/deployenv.sh --type instance --env %22%0A                       + self.env + %22 --appName %22 + self.appName)%0A%0A
 %0Adef

remove the call to deployenv and add it to the prior step of logging.