Module and states code refactor

Change-Id: Ia1c468d0b55603b6274ca0d275b2720602e5319e
diff --git a/_states/jenkins_theme.py b/_states/jenkins_theme.py
index 2f0208b..c27b0a2 100644
--- a/_states/jenkins_theme.py
+++ b/_states/jenkins_theme.py
@@ -2,26 +2,27 @@
 logger = logging.getLogger(__name__)
 
 set_theme_groovy = """\
-try{{
-    if(Class.forName("org.codefirst.SimpleThemeDecorator")){{
+try{
+    if(Class.forName("org.codefirst.SimpleThemeDecorator")){
         def state;
-        for (pd in PageDecorator.all()) {{
-          if (pd instanceof org.codefirst.SimpleThemeDecorator) {{
-            if(!pd.cssUrl.equals("{css_url}") || !pd.jsUrl.equals("{js_url}")){{
-                pd.cssUrl = "{css_url}"
-                pd.jsUrl = "{js_url}"
+        for (pd in PageDecorator.all()) {
+          if (pd instanceof org.codefirst.SimpleThemeDecorator) {
+            if(!pd.cssUrl.equals("${css_url}") || !pd.jsUrl.equals("${js_url}")){
+                pd.cssUrl = "${css_url}"
+                pd.jsUrl = "${js_url}"
                 state="SUCCESS"
-            }}else{{
+            }else{
                 state="EXISTS"
-            }}
-          }}
-        }}
+            }
+          }
+        }
         print(state)
-    }}
-}}catch(ClassNotFoundException e){{
+    }
+}catch(ClassNotFoundException e){
     print("Cannot user SimpleThemeDecorator, maybe Simple Theme Plugin not installed")
-}}
-""" # noqa
+}
+"""  # noqa
+
 
 def __virtual__():
     '''
@@ -59,17 +60,19 @@
     else:
         call_result = __salt__['jenkins_common.call_groovy_script'](
             set_theme_groovy, {"css_url": css_url, "js_url": js_url})
-        if call_result["code"] == 200 and call_result["msg"] in ["SUCCESS", "EXISTS"]:
+        if call_result["code"] == 200 and call_result["msg"] in [
+                "SUCCESS", "EXISTS"]:
             status = call_result["msg"]
             if status == "SUCCESS":
                 ret['changes'][name] = status
-            ret['comment'] = 'Jenkins theme config %s %s' % (name, status.lower())
+            ret['comment'] = 'Jenkins theme config %s %s' % (
+                name, status.lower())
             result = True
         else:
             status = 'FAILED'
             logger.error(
                 "Jenkins theme API call failure: %s", call_result["msg"])
             ret['comment'] = 'Jenkins theme API call failure: %s' % (call_result[
-                                                                           "msg"])
+                "msg"])
     ret['result'] = None if test else result
     return ret