def setupLetsEncrypt(self, ee_domain_name):
    ee_wp_email = EEVariables.ee_email
    while not ee_wp_email:
        try:
            ee_wp_email = input('Enter WordPress email: ')
        except EOFError as e:
            Log.debug(self, "{0}".format(e))
            raise SiteError("input WordPress username failed")

    if not os.path.isdir("/opt/letsencrypt"):
        cloneLetsEncrypt(self)
    EEFileUtils.chdir(self, '/opt/letsencrypt')
    EEShellExec.cmd_exec(self, "git pull")

    if os.path.isfile("/etc/letsencrypt/renewal/{0}.conf".format(ee_domain_name)):
        Log.debug(self, "LetsEncrypt SSL Certificate found for the domain {0}"
                 .format(ee_domain_name))
        ssl= archivedCertificateHandle(self,ee_domain_name,ee_wp_email)
    else:
        Log.warn(self,"Please Wait while we fetch SSL Certificate for your site.\nIt may take time depending upon network.")
        ssl = EEShellExec.cmd_exec(self, "./letsencrypt-auto certonly --webroot -w /var/www/{0}/htdocs/ -d {0} -d www.{0} "
                                .format(ee_domain_name)
                                + "--email {0} --text --agree-tos".format(ee_wp_email))
    if ssl:
        Log.info(self, "Let's Encrypt successfully setup for your site")
        Log.info(self, "Your certificate and chain have been saved at "
                            "/etc/letsencrypt/live/{0}/fullchain.pem".format(ee_domain_name))
        Log.info(self, "Configuring Nginx SSL configuration")

        try:
            Log.info(self, "Adding /var/www/{0}/conf/nginx/ssl.conf".format(ee_domain_name))

            sslconf = open("/var/www/{0}/conf/nginx/ssl.conf"
                                      .format(ee_domain_name),
                                      encoding='utf-8', mode='w')
            sslconf.write("listen 443 ssl {http2};\n".format(http2=("http2" if
                                                           EEAptGet.is_installed(self,'nginx-mainline') else "spdy")) +
                                     "ssl on;\n"
                                     "ssl_certificate     /etc/letsencrypt/live/{0}/fullchain.pem;\n"
                                     "ssl_certificate_key     /etc/letsencrypt/live/{0}/privkey.pem;\n"
                                     .format(ee_domain_name))
            sslconf.close()
            # updateSiteInfo(self, ee_domain_name, ssl=True)

            EEGit.add(self, ["/etc/letsencrypt"],
              msg="Adding letsencrypt folder")

        except __HOLE__ as e:
            Log.debug(self, str(e))
            Log.debug(self, "Error occured while generating "
                              "ssl.conf")
    else:
        Log.error(self, "Unable to setup, Let\'s Encrypt", False)
        Log.error(self, "Please make sure that your site is pointed to \n"
                        "same server on which you are running Let\'s Encrypt Client "
                        "\n to allow it to verify the site automatically.")
dataset/ETHPy150Open EasyEngine/easyengine/ee/cli/plugins/site_functions.py/setupLetsEncrypt