Skip to content
This repository has been archived by the owner on Feb 8, 2019. It is now read-only.

Commit

Permalink
Fixes #11055: Rudder can't start anymore because does not find config…
Browse files Browse the repository at this point in the history
…uration-repository techniques category in git
  • Loading branch information
fanf committed Jun 29, 2017
1 parent 9251af7 commit 68e25fb
Showing 1 changed file with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,22 @@ class GitTechniqueReader(
}
}

private final case class NoRootCategory(msg: String) extends Exception(msg)

private[this] var currentTechniquesInfoCache : TechniquesInfo = {
try {
processRevTreeId(revisionProvider.currentRevTreeId)
} catch {
case NoRootCategory(msg) =>
logger.error(s"The stored Git revision does not provide a root category.xml, which is mandatory. Error message was: ${msg}")
val newRevTreeId = revisionProvider.getAvailableRevTreeId
if(newRevTreeId != revisionProvider.currentRevTreeId) {
logger.error(s"Trying to load last available revision of the technique library to unstuck the situation.")
revisionProvider.setCurrentRevTreeId(newRevTreeId)
processRevTreeId(newRevTreeId)
} else {
sys.error("Please add a root category.xml and commit it before restarting Rudder.")
}
case e:MissingObjectException => //ah, that commit is not know on our repos
logger.error("The stored Git revision for the last version of the known Technique Library was not found in the local Git repository. " +
"That may happen if a commit was reverted, the Git repository was deleted and created again, or if LDAP datas where corrupted. Loading the last available Techique library version.")
Expand Down Expand Up @@ -522,13 +533,13 @@ class GitTechniqueReader(

var root = maybeCategories.get(RootTechniqueCategoryId) match {
case None =>
sys.error("Missing techniques root category in Git, expecting category descriptor for Git path: '%s'".format(
repo.db.getWorkTree.getPath + canonizedRelativePath.map( "/" + _ + "/" + categoryDescriptorName).getOrElse("")))
val path = repo.db.getWorkTree.getPath + canonizedRelativePath.map( "/" + _ + "/" + categoryDescriptorName).getOrElse("")
throw new NoRootCategory(s"Missing techniques root category in Git, expecting category descriptor for Git path: '${path}'")
case Some(sub:SubTechniqueCategory) =>
logger.error("Bad type for root category in the Technique Library. Please check the hierarchy of categories")
sys.error("Bad type for root category, found: " + sub)
throw new NoRootCategory(s"Bad type for root category in the Technique Library, found: '${sub}'. Please check the hierarchy of categories")
case Some(r:RootTechniqueCategory) => r
}
}

//update subcategories
techniqueInfos.subCategories.toSeq.foreach {
Expand Down

0 comments on commit 68e25fb

Please sign in to comment.