Skip to content

Commit

Permalink
Remove webapp dependency on RDECK_BASE/etc. Tools are likely not work…
Browse files Browse the repository at this point in the history
…ing as there are numerous references to baseDir and etc.
  • Loading branch information
noahcampbell committed Nov 19, 2010
1 parent adb59d8 commit 8613004
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 10 deletions.
6 changes: 3 additions & 3 deletions core/src/java/com/dtolabs/launcher/Check.java
Expand Up @@ -176,7 +176,7 @@ void testBaseDir(final RequiredParams params, final Properties inputProps) throw
* @param baseDir RUNDECK base directory
*/
void testBaseFiles(final File baseDir) {
final File etcDir = new File(baseDir, "etc");
final File etcDir = new File(Constants.getFrameworkConfigDir(baseDir.getAbsolutePath()));
reporter.beginCheckOnDirectory(etcDir);
final String[] requiredFiles = new String[]{
"framework.properties",
Expand Down Expand Up @@ -254,7 +254,7 @@ void testEtcDepotProperties(final File baseDir, final Properties inputProps) thr

void testEtcLog4jProperties(final File baseDir, final Properties inputProps) throws
CheckException {
final File file = new File(baseDir, "etc/log4j.properties");
final File file = new File(new File(Constants.getFrameworkConfigDir(baseDir.getAbsolutePath())), "log4j.properties");

final Properties expectedProps = new Properties();
/*
Expand Down Expand Up @@ -356,7 +356,7 @@ void testEtcNodeProperties(final File baseDir, final Properties inputProps) thro
*/
void testEtcFrameworkProperties(final File baseDir, final RequiredParams params,
final Properties inputProps) throws CheckException {
final File file = new File(baseDir, "etc/framework.properties");
final File file = new File(new File(Constants.getFrameworkConfigDir(baseDir.getAbsolutePath())), "framework.properties");
final Collection<String> requiredExistProperties = new ArrayList<String>();


Expand Down
2 changes: 1 addition & 1 deletion core/src/java/com/dtolabs/rundeck/core/Constants.java
Expand Up @@ -207,7 +207,7 @@ public static final String getSystemBaseDir(){
* @param rdeck_base Ctl Base directory
*/
public static final String getFrameworkConfigDir(final String rdeck_base) {
return rdeck_base + FILE_SEP + "etc";
return System.getProperty("rdeck.config", rdeck_base + FILE_SEP + "etc");
}

/**
Expand Down
Expand Up @@ -151,6 +151,7 @@ public Decision evaluate(Map<String, String> resource, Subject subject,
decision.explain().describe(pw);
sb.append(out.toString());

System.err.println(sb.toString());
logger.info(sb.toString());

return decision;
Expand Down
5 changes: 3 additions & 2 deletions core/src/java/com/dtolabs/rundeck/core/common/Framework.java
Expand Up @@ -105,9 +105,10 @@ public void initialize() {
authenticationMgr = AuthenticationMgrFactory.create(lookup.getProperty(AUTHENT_CLS_PROP), this)
.getAuthenticationMgr();
}
System.err.println("Using " + getConfigDir());
if(null==authorizationMgr){
authorizationMgr = AuthorizationMgrFactory.create(lookup.getProperty(AUTHORIZE_CLS_PROP),
this, new File(getBaseDir(), "etc")).getAuthorizationMgr();
this, getConfigDir()).getAuthorizationMgr();
}
if(null==centralDispatcherMgr){
try {
Expand Down Expand Up @@ -593,7 +594,7 @@ public Collection<INodeEntry> filterNodes(final NodeSet nodeset, final String pr
}

public File getConfigDir() {
return new File(getBaseDir(), "etc");
return new File(Constants.getFrameworkConfigDir(getBaseDir().getAbsolutePath()));
}


Expand Down
5 changes: 3 additions & 2 deletions rundeckapp/grails-app/conf/BootStrap.groovy
@@ -1,3 +1,4 @@
import com.dtolabs.rundeck.core.Constants;
import com.dtolabs.rundeck.core.utils.ThreadBoundOutputStream
import org.springframework.web.context.support.WebApplicationContextUtils
import org.springframework.web.context.WebApplicationContext
Expand Down Expand Up @@ -74,8 +75,8 @@ class BootStrap {
setup.performSetup()
log.info("Rundeck initialization complete.")
}

File f = new File(rdeckBase, "etc/framework.properties")
def configDir = Constants.getFrameworkConfigDir(rdeckBase)
File f = new File(configDir, "framework.properties")
if (! f.exists()) {
throw new RuntimeException("framework configuration file not found: " + f.getAbsolutePath())
}
Expand Down
6 changes: 4 additions & 2 deletions rundeckapp/grails-app/services/FrameworkService.groovy
Expand Up @@ -6,6 +6,8 @@ import org.springframework.beans.BeansException
import org.springframework.context.ApplicationContext
import org.springframework.context.ApplicationContextAware

import com.dtolabs.rundeck.core.Constants

/**
* Interfaces with the core Framework object
*/
Expand Down Expand Up @@ -94,7 +96,7 @@ class FrameworkService implements ApplicationContextAware {
log.warn("rdeck.base is: ${rundeckbase}")

//determine list of possible acl roles
List l = BaseAclsAuthorization.listRoles(new File(rundeckbase, "etc"))
List l = BaseAclsAuthorization.listRoles(new File(Constants.getFrameworkConfigDir(rundeckbase)))

List rolelist = getUserRoleList(request,l)
session.roles=rolelist
Expand All @@ -112,7 +114,7 @@ class FrameworkService implements ApplicationContextAware {
def Framework fw = Framework.getInstance(rundeckbase)
if(null!=user && null != rolelist){
def authen = new SingleUserAuthentication(user,"")
def author = new SingleUserAclsAuthorization(fw,new File(rundeckbase, "etc"), user, rolelist.toArray(new String[0]))
def author = new SingleUserAclsAuthorization(fw,new File(Constants.getFrameworkConfigDir(rundeckbase)), user, rolelist.toArray(new String[0]))
fw.setAuthenticationMgr(authen)
fw.setAuthorizationMgr(author)
}
Expand Down

0 comments on commit 8613004

Please sign in to comment.