Skip to content
Permalink
Browse files

JENKINS-33800 - fileNotFound exception if jenkins 1 installed, security

settings saved but global config is not - show normal login in this case
  • Loading branch information...
kzantow committed Mar 29, 2016
1 parent 6219c8f commit da3bb81fadc966cc2df74b18c20a6eb01cf4806e
@@ -107,30 +107,44 @@ public SetupWizard(Jenkins j) throws IOException, InterruptedException {
}
}

String setupKey = iapf.readToString().trim();
String ls = System.lineSeparator();
LOGGER.info(ls + ls + "*************************************************************" + ls
+ "*************************************************************" + ls
+ "*************************************************************" + ls
+ ls
+ "Jenkins initial setup is required. An admin user has been created and "
+ "a password generated." + ls
+ "Please use the following password to proceed to installation:" + ls
+ ls
+ setupKey + ls
+ ls
+ "This may also be found at: " + iapf.getRemote() + ls
+ ls
+ "*************************************************************" + ls
+ "*************************************************************" + ls
+ "*************************************************************" + ls);
if(iapf.exists()) {
String setupKey = iapf.readToString().trim();
String ls = System.lineSeparator();
LOGGER.info(ls + ls + "*************************************************************" + ls
+ "*************************************************************" + ls
+ "*************************************************************" + ls
+ ls
+ "Jenkins initial setup is required. An admin user has been created and "
+ "a password generated." + ls
+ "Please use the following password to proceed to installation:" + ls
+ ls
+ setupKey + ls
+ ls
+ "This may also be found at: " + iapf.getRemote() + ls
+ ls
+ "*************************************************************" + ls
+ "*************************************************************" + ls
+ "*************************************************************" + ls);
}

try {
PluginServletFilter.addFilter(FORCE_SETUP_WIZARD_FILTER);
} catch (ServletException e) {
throw new AssertionError(e);
}
}

/**
* Indicates a generated password should be used - e.g. this is a new install, no security realm set up
*/
public boolean useGeneratedPassword() {
try {
return getInitialAdminPasswordFile().exists();
} catch (Exception e) {
// ignore
}
return false;
}

/**
* Gets the file used to store the initial admin password
@@ -24,10 +24,11 @@ THE SOFTWARE.

<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<j:if test="${it.setupWizard != null}">
<j:choose>
<j:when test="${it.setupWizard.useGeneratedPassword()}">
<st:include it="${it.setupWizard}" page="authenticate-security-token"/>
</j:if>
<j:if test="${it.setupWizard == null}">
</j:when>
<j:otherwise>
<l:layout norefresh="true">
<l:hasPermission permission="${app.READ}">
<st:include page="sidepanel.jelly" />
@@ -74,5 +75,6 @@ THE SOFTWARE.
</div>
</l:main-panel>
</l:layout>
</j:if>
</j:otherwise>
</j:choose>
</j:jelly>

0 comments on commit da3bb81

Please sign in to comment.
You can’t perform that action at this time.