refactor packages

This commit is contained in:
az 2021-08-07 16:58:56 +02:00
parent f5bf7865d5
commit 77f2cf7c10
78 changed files with 232 additions and 235 deletions

View file

@ -79,7 +79,7 @@ task fatJar(type: Jar) {
manifest {
attributes 'Implementation-Title': 'Gradle Jar File Example',
'Implementation-Version': project.version,
'Main-Class': 'io.provs.entry.EntryKt'
'Main-Class': 'io.provs.core.entry.EntryKt'
}
archivesBaseName = project.name + '-all'
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
@ -99,7 +99,7 @@ task fatJarLatest(type: Jar) {
manifest {
attributes 'Implementation-Title': 'Gradle Jar File Example',
'Implementation-Version': project.version,
'Main-Class': 'io.provs.entry.EntryKt'
'Main-Class': 'io.provs.core.entry.EntryKt'
}
with jar
archiveFileName = 'provs-fat-latest.jar'
@ -121,7 +121,7 @@ task uberJar(type: Jar) {
manifest {
attributes 'Implementation-Title': 'Gradle Jar File Example',
'Implementation-Version': project.version,
'Main-Class': 'io.provs.entry.EntryKt'
'Main-Class': 'io.provs.core.entry.EntryKt'
}
archiveClassifier = 'uber'
}
@ -142,7 +142,7 @@ task uberJarLatest(type: Jar) {
manifest {
attributes 'Implementation-Title': 'Gradle Jar File Example',
'Implementation-Version': project.version,
'Main-Class': 'io.provs.entry.EntryKt'
'Main-Class': 'io.provs.core.entry.EntryKt'
}
archiveFileName = 'provs-latest.jar'
}

View file

@ -1,14 +1,13 @@
package io.provs
package io.provs.core
import io.provs.platforms.SHELL
import io.provs.platforms.UbuntuProv
import io.provs.platforms.WinProv
import io.provs.processors.LocalProcessor
import io.provs.processors.Processor
import io.provs.core.platforms.SHELL
import io.provs.core.platforms.UbuntuProv
import io.provs.core.platforms.WinProv
import io.provs.core.processors.LocalProcessor
import io.provs.core.processors.Processor
import org.slf4j.LoggerFactory
enum class ProgressType { NONE, DOTS, BASIC, FULL_LOG }
enum class ResultMode { NONE, LAST, ALL, FAILEXIT }
enum class OS { WINDOWS, LINUX }
@ -37,7 +36,7 @@ open class Prov protected constructor(
private lateinit var defaultProvInstance: Prov
fun defaultInstance(platform: String? = null): Prov {
return if (::defaultProvInstance.isInitialized) {
return if (Factory::defaultProvInstance.isInitialized) {
defaultProvInstance
} else {
defaultProvInstance = newInstance(platform = platform, name = "default instance")

View file

@ -1,4 +1,4 @@
package io.provs
package io.provs.core
data class ProvResult(val success: Boolean,
@ -16,6 +16,7 @@ data class ProvResult(val success: Boolean,
(exception?.run { " Exception: " + toString() } ?: "")
}
@Suppress("unused")
fun toShortString() : String {
return "ProvResult:: ${if (success) "Succeeded" else "FAILED"} -- " +
if (!success)

View file

@ -1,4 +1,4 @@
package io.provs
package io.provs.core
open class Secret(private val value: String) {

View file

@ -1,9 +1,10 @@
package io.provs
package io.provs.core
import io.provs.docker.provideContainer
import io.provs.processors.ContainerStartMode
import io.provs.processors.ContainerUbuntuHostProcessor
import io.provs.processors.RemoteProcessor
import io.provs.core.docker.provideContainer
import io.provs.core.processors.ContainerStartMode
import io.provs.core.processors.ContainerUbuntuHostProcessor
import io.provs.core.processors.RemoteProcessor
import io.provs.core.tags.Api
import java.io.File
import java.net.InetAddress
@ -70,7 +71,7 @@ fun local(): Prov {
* If password is null, connection is done by ssh-key.
* Platform (Linux, Windows) must be provided if different from local platform.
*/
@Suppress("unused") // used by other libraries resp. KotlinScript
@Api // used by other libraries resp. KotlinScript
fun remote(host: String, remoteUser: String, password: Secret? = null, platform: String? = null): Prov {
require(host.isNotEmpty(), { "Host must not be empty." })
require(remoteUser.isNotEmpty(), { "Remote user must not be empty." })
@ -85,7 +86,7 @@ fun remote(host: String, remoteUser: String, password: Secret? = null, platform:
* parameter useExistingContainer is set to true.
* If a new container needs to be created, on Linux systems the image _ubuntu_ is used.
*/
@Suppress("unused") // used by other libraries resp. KotlinScript
@Api // used by other libraries resp. KotlinScript
fun docker(containerName: String = "provs_default", useExistingContainer: Boolean = true): Prov {
val os = System.getProperty("os.name")

View file

@ -1,12 +1,11 @@
package io.provs.docker
import io.provs.Prov
import io.provs.ProvResult
import io.provs.docker.images.DockerImage
import io.provs.docker.platforms.*
import io.provs.platforms.UbuntuProv
import io.provs.processors.ContainerStartMode
package io.provs.core.docker
import io.provs.core.Prov
import io.provs.core.ProvResult
import io.provs.core.docker.dockerimages.DockerImage
import io.provs.core.docker.platforms.*
import io.provs.core.platforms.UbuntuProv
import io.provs.core.processors.ContainerStartMode
/**
* Builds a docker image if not yet existing.
@ -19,7 +18,6 @@ fun Prov.dockerProvideImage(image: DockerImage, skipIfExisting: Boolean = true,
}
}
/**
* Returns true if the specified docker image exists.
*/
@ -31,7 +29,6 @@ fun Prov.dockerImageExists(imageName: String, sudo: Boolean = true) : Boolean {
}
}
/**
* Creates and runs a new container with name _containerName_ for image _imageName_ if not yet existing.
* In case the container already exists, the parameter _startMode_ determines
@ -75,8 +72,6 @@ fun Prov.runContainer(
}
fun Prov.exitAndRmContainer(
containerName: String,
sudo: Boolean = true

View file

@ -1,4 +1,4 @@
package io.provs.docker.images
package io.provs.core.docker.dockerimages
interface DockerImage {
@ -7,9 +7,8 @@ interface DockerImage {
}
/**
* Dockerfile based ubuntu image added by a non-root default user.
* Provides a docker image based on ubuntu additionally with a non-root default user and sudo isntalled
*/
@Suppress("unused") // used by other libraries
class UbuntuPlusUser(private val userName: String = "testuser") : DockerImage {
override fun imageName(): String {

View file

@ -1,15 +1,15 @@
package io.provs.docker.platforms
package io.provs.core.docker.platforms
import io.provs.ProvResult
import io.provs.docker.containerRuns
import io.provs.docker.dockerImageExists
import io.provs.docker.exitAndRmContainer
import io.provs.docker.images.DockerImage
import io.provs.escapeSingleQuote
import io.provs.fileSeparator
import io.provs.hostUserHome
import io.provs.platforms.UbuntuProv
import io.provs.processors.ContainerStartMode
import io.provs.core.ProvResult
import io.provs.core.docker.containerRuns
import io.provs.core.docker.dockerImageExists
import io.provs.core.docker.exitAndRmContainer
import io.provs.core.docker.dockerimages.DockerImage
import io.provs.core.escapeSingleQuote
import io.provs.core.fileSeparator
import io.provs.core.hostUserHome
import io.provs.core.platforms.UbuntuProv
import io.provs.core.processors.ContainerStartMode
fun UbuntuProv.provideContainerPlatform(

View file

@ -1,4 +1,4 @@
package io.provs.entry
package io.provs.core.entry
/**
* Calls a static method of a class.

View file

@ -1,11 +1,11 @@
package io.provs.platforms
package io.provs.core.platforms
import io.provs.ProgressType
import io.provs.Prov
import io.provs.ProvResult
import io.provs.escapeAndEncloseByDoubleQuoteForShell
import io.provs.processors.LocalProcessor
import io.provs.processors.Processor
import io.provs.core.ProgressType
import io.provs.core.Prov
import io.provs.core.ProvResult
import io.provs.core.escapeAndEncloseByDoubleQuoteForShell
import io.provs.core.processors.LocalProcessor
import io.provs.core.processors.Processor
const val SHELL = "/bin/bash"

View file

@ -1,10 +1,10 @@
package io.provs.platforms
package io.provs.core.platforms
import io.provs.ProgressType
import io.provs.Prov
import io.provs.ProvResult
import io.provs.processors.LocalProcessor
import io.provs.processors.Processor
import io.provs.core.ProgressType
import io.provs.core.Prov
import io.provs.core.ProvResult
import io.provs.core.processors.LocalProcessor
import io.provs.core.processors.Processor
class WinProv internal constructor(processor : Processor = LocalProcessor(), name: String? = null, progressType: ProgressType)

View file

@ -1,10 +1,11 @@
package io.provs.processors
package io.provs.core.processors
import io.provs.ProgressType
import io.provs.Prov
import io.provs.docker.provideContainer
import io.provs.escapeAndEncloseByDoubleQuoteForShell
import io.provs.platforms.SHELL
import io.provs.core.ProgressType
import io.provs.core.Prov
import io.provs.core.docker.provideContainer
import io.provs.core.escapeAndEncloseByDoubleQuoteForShell
import io.provs.core.platforms.SHELL
import io.provs.core.tags.Api
enum class ContainerStartMode {
USE_RUNNING_ELSE_CREATE,
@ -19,12 +20,12 @@ enum class ContainerEndMode {
open class ContainerUbuntuHostProcessor(
private val containerName: String = "default_provs_container",
@Suppress("unused") // suppress false positive warning
@Api // suppress false positive warning
private val dockerImage: String = "ubuntu",
@Suppress("unused") // suppress false positive warning
@Api // suppress false positive warning
private val startMode: ContainerStartMode = ContainerStartMode.USE_RUNNING_ELSE_CREATE,
private val endMode: ContainerEndMode = ContainerEndMode.KEEP_RUNNING,
@Suppress("unused") // suppress false positive warning
@Api // suppress false positive warning
private val sudo: Boolean = true
) : Processor {
private val dockerCmd = if (sudo) "sudo docker " else "docker "

View file

@ -1,6 +1,6 @@
package io.provs.processors
package io.provs.core.processors
import io.provs.escapeNewline
import io.provs.core.escapeNewline
import org.slf4j.LoggerFactory
import java.io.File
import java.io.IOException
@ -17,7 +17,7 @@ open class LocalProcessor : Processor {
@Suppress("JAVA_CLASS_ON_COMPANION")
private val log = LoggerFactory.getLogger(javaClass.enclosingClass)
var charset = if (getOsName().contains("Windows")) Charset.forName("Windows-1252") else Charset.defaultCharset()
var charset: Charset = if (getOsName().contains("Windows")) Charset.forName("Windows-1252") else Charset.defaultCharset()
init {
log.info("os.name: " + getOsName())
log.info("user.home: " + System.getProperty("user.home"))

View file

@ -1,4 +1,4 @@
package io.provs.processors
package io.provs.core.processors
@Suppress("unused") // used externally

View file

@ -1,10 +1,12 @@
package io.provs.processors
package io.provs.core.processors
interface Processor {
fun x(vararg args: String): ProcessResult
fun xNoLog(vararg args: String): ProcessResult
fun close() {}
fun close() {
// no action needed for most processors; if action is needed when closing, this method must be overwritten in the subclass
}
}

View file

@ -1,9 +1,9 @@
package io.provs.processors
package io.provs.core.processors
import io.provs.Secret
import io.provs.escapeAndEncloseByDoubleQuoteForShell
import io.provs.escapeNewline
import io.provs.platforms.SHELL
import io.provs.core.Secret
import io.provs.core.escapeAndEncloseByDoubleQuoteForShell
import io.provs.core.escapeNewline
import io.provs.core.platforms.SHELL
import net.schmizz.sshj.SSHClient
import net.schmizz.sshj.connection.channel.direct.Session
import net.schmizz.sshj.connection.channel.direct.Session.Command
@ -80,7 +80,6 @@ class RemoteProcessor(ip: InetAddress, user: String, password: Secret? = null) :
else
args.joinToString(separator = " ")
var session: Session? = null
try {

View file

@ -0,0 +1,6 @@
package io.provs.core.tags
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.EXPRESSION)
@Retention(AnnotationRetention.SOURCE)
@Suppress("unused") // element is offered to be used externally
annotation class Api

View file

@ -1,7 +1,7 @@
package io.provs.ubuntu.extensions.demos
import io.provs.Prov
import io.provs.local
import io.provs.core.Prov
import io.provs.core.local
fun Prov.helloWorld() = def {

View file

@ -1,6 +1,6 @@
package io.provs.ubuntu.extensions.demos
import io.provs.*
import io.provs.core.*
/**

View file

@ -1,6 +1,6 @@
package io.provs.ubuntu.extensions.server_compounds.monitoring
import io.provs.Prov
import io.provs.core.Prov
import io.provs.ubuntu.extensions.server_software.nginx.base.NginxConf
import io.provs.ubuntu.extensions.server_software.nginx.base.nginxHttpConf
import io.provs.ubuntu.extensions.server_software.nginx.provisionNginxStandAlone

View file

@ -1,6 +1,6 @@
package io.provs.ubuntu.extensions.server_compounds.monitoring
import io.provs.Prov
import io.provs.core.Prov
import io.provs.ubuntu.extensions.server_software.nginx.base.NginxConf
import io.provs.ubuntu.extensions.server_software.nginx.base.nginxAddLocation
import io.provs.ubuntu.extensions.server_software.nginx.base.nginxCreateSelfSignedCertificate

View file

@ -1,7 +1,7 @@
package io.provs.ubuntu.extensions.server_software.certbot
import io.provs.Prov
import io.provs.ProvResult
import io.provs.core.Prov
import io.provs.core.ProvResult
import io.provs.ubuntu.filesystem.base.fileExists
import io.provs.ubuntu.install.base.aptInstall

View file

@ -1,7 +1,7 @@
package io.provs.ubuntu.extensions.server_software.firewall
import io.provs.Prov
import io.provs.ProvResult
import io.provs.core.Prov
import io.provs.core.ProvResult
import io.provs.ubuntu.install.base.aptInstall

View file

@ -1,7 +1,7 @@
package io.provs.ubuntu.extensions.server_software.firewall.base
import io.provs.Prov
import io.provs.ProvResult
import io.provs.core.Prov
import io.provs.core.ProvResult
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter

View file

@ -1,9 +1,9 @@
package io.provs.ubuntu.extensions.server_software.nexus
import io.provs.Prov
import io.provs.ProvResult
import io.provs.docker.containerRuns
import io.provs.remote
import io.provs.core.Prov
import io.provs.core.ProvResult
import io.provs.core.docker.containerRuns
import io.provs.core.remote
import io.provs.ubuntu.filesystem.base.fileExists
import io.provs.ubuntu.install.base.aptInstall
import io.provs.ubuntu.user.base.createUser

View file

@ -1,8 +1,8 @@
package io.provs.ubuntu.extensions.server_software.nginx
import io.provs.Prov
import io.provs.ProvResult
import io.provs.remote
import io.provs.core.Prov
import io.provs.core.ProvResult
import io.provs.core.remote
import io.provs.ubuntu.filesystem.base.createFile
import io.provs.ubuntu.filesystem.base.fileExists
import io.provs.ubuntu.install.base.aptInstall

View file

@ -1,7 +1,7 @@
package io.provs.ubuntu.extensions.server_software.nginx.base
import io.provs.Prov
import io.provs.Secret
import io.provs.core.Prov
import io.provs.core.Secret
import io.provs.ubuntu.install.base.aptInstall
fun Prov.nginxAddBasicAuth(user: String, password: Secret) = requireAll {

View file

@ -1,7 +1,7 @@
package io.provs.ubuntu.extensions.server_software.nginx.base
import io.provs.Prov
import io.provs.ProvResult
import io.provs.core.Prov
import io.provs.core.ProvResult
import io.provs.ubuntu.filesystem.base.*

View file

@ -1,6 +1,6 @@
package io.provs.ubuntu.extensions.server_software.nginx.base
import io.provs.Prov
import io.provs.core.Prov
import io.provs.ubuntu.filesystem.base.createDirs
import io.provs.ubuntu.extensions.server_software.nginx.provisionNginxStandAlone

View file

@ -1,6 +1,6 @@
package io.provs.ubuntu.extensions.server_software.prometheus
import io.provs.Prov
import io.provs.core.Prov
import io.provs.ubuntu.extensions.server_software.prometheus.base.*
/**

View file

@ -1,7 +1,6 @@
package io.provs.ubuntu.extensions.server_software.prometheus.base
import io.provs.Prov
import io.provs.local
import io.provs.core.Prov
import io.provs.ubuntu.filesystem.base.createDir
import io.provs.ubuntu.filesystem.base.createFile
import io.provs.ubuntu.filesystem.base.fileContainsText

View file

@ -1,8 +1,7 @@
package io.provs.ubuntu.extensions.server_software.prometheus.base
import io.provs.Prov
import io.provs.docker.containerRuns
import io.provs.local
import io.provs.core.Prov
import io.provs.core.docker.containerRuns
import io.provs.ubuntu.filesystem.base.createDirs
import io.provs.ubuntu.filesystem.base.createFile
import io.provs.ubuntu.install.base.aptInstall

View file

@ -1,7 +1,7 @@
package io.provs.ubuntu.extensions.workplace
import io.provs.*
import io.provs.processors.RemoteProcessor
import io.provs.core.*
import io.provs.core.processors.RemoteProcessor
import io.provs.ubuntu.extensions.workplace.base.*
import io.provs.ubuntu.git.provisionGit
import io.provs.ubuntu.install.base.aptInstall

View file

@ -1,6 +1,6 @@
package io.provs.ubuntu.extensions.workplace.base
import io.provs.Prov
import io.provs.core.Prov
import io.provs.ubuntu.install.base.aptInstall
fun Prov.installDocker() = def {

View file

@ -1,6 +1,6 @@
package io.provs.ubuntu.extensions.workplace.base
import io.provs.Prov
import io.provs.core.Prov
import io.provs.ubuntu.filesystem.base.createDir
import io.provs.ubuntu.web.base.downloadFromURL

View file

@ -1,7 +1,7 @@
package io.provs.ubuntu.extensions.workplace.base
import io.provs.Prov
import io.provs.ProvResult
import io.provs.core.Prov
import io.provs.core.ProvResult
import io.provs.ubuntu.filesystem.base.createDir
import io.provs.ubuntu.filesystem.base.createDirs
import io.provs.ubuntu.filesystem.base.createFile
@ -30,11 +30,12 @@ fun Prov.installGopass(version: String = "1.12.7", enforceVersion: Boolean = fal
fun Prov.configureGopass(gopassRootFolder: String? = null) = def {
val gopassRootFolderNonNull = (gopassRootFolder ?: userHome()) + ".password-store"
val defaultRootFolder = userHome() + ".password-store"
val rootFolder = gopassRootFolder ?: defaultRootFolder
// use default
createDir(gopassRootFolderNonNull)
createDirs(".config/gopass", "~/")
createFile("~/.config/gopass/config.yml", gopassConfig(gopassRootFolderNonNull))
createDir(rootFolder)
createDirs(".config/gopass")
createFile("~/.config/gopass/config.yml", gopassConfig(rootFolder))
}

View file

@ -1,7 +1,7 @@
package io.provs.ubuntu.extensions.workplace.base
import io.provs.Prov
import io.provs.ProvResult
import io.provs.core.Prov
import io.provs.core.ProvResult
import io.provs.ubuntu.filesystem.base.createDir
import io.provs.ubuntu.filesystem.base.createDirs
import io.provs.ubuntu.filesystem.base.userHome

View file

@ -1,6 +1,6 @@
package io.provs.ubuntu.extensions.workplace.base
import io.provs.Prov
import io.provs.core.Prov
import io.provs.ubuntu.filesystem.base.addTextToFile
import java.io.File

View file

@ -1,6 +1,6 @@
package io.provs.ubuntu.extensions.workplace.base
import io.provs.Prov
import io.provs.core.Prov
import io.provs.ubuntu.filesystem.base.createDir
import io.provs.ubuntu.filesystem.base.createFile
import io.provs.ubuntu.install.base.aptInstall

View file

@ -1,7 +1,7 @@
package io.provs.ubuntu.extensions.workplace.base
import io.provs.Prov
import io.provs.ProvResult
import io.provs.core.Prov
import io.provs.core.ProvResult
import io.provs.ubuntu.install.base.aptInstall

View file

@ -1,12 +1,8 @@
package io.provs.ubuntu.extensions.workplace.base
import io.provs.Prov
import io.provs.ProvResult
import io.provs.remote
import io.provs.core.Prov
import io.provs.core.ProvResult
import io.provs.ubuntu.install.base.aptInstall
import io.provs.ubuntu.secret.secretSources.GopassSecretSource
import io.provs.ubuntu.secret.secretSources.PlainSecretSource
import io.provs.ubuntu.secret.secretSources.PromptSecretSource
import io.provs.ubuntu.user.base.whoami
fun Prov.installVirtualBoxGuestAdditions() = def {

View file

@ -1,7 +1,7 @@
package io.provs.ubuntu.extensions.workplace.base
import io.provs.Prov
import io.provs.ProvResult
import io.provs.core.Prov
import io.provs.core.ProvResult
import io.provs.ubuntu.install.base.aptInstall
import io.provs.ubuntu.install.base.aptInstallFromPpa
import io.provs.ubuntu.install.base.isPackageInstalled

View file

@ -1,7 +1,7 @@
package io.provs.ubuntu.filesystem.base
import io.provs.*
import io.provs.platforms.SHELL
import io.provs.core.*
import io.provs.core.platforms.SHELL
import java.io.File

View file

@ -1,7 +1,7 @@
package io.provs.ubuntu.git
import io.provs.Prov
import io.provs.ProvResult
import io.provs.core.Prov
import io.provs.core.ProvResult
import io.provs.ubuntu.install.base.aptInstall

View file

@ -1,7 +1,7 @@
package io.provs.ubuntu.git.base
import io.provs.Prov
import io.provs.ProvResult
import io.provs.core.Prov
import io.provs.core.ProvResult
import io.provs.ubuntu.filesystem.base.addTextToFile
import io.provs.ubuntu.filesystem.base.createDir
import io.provs.ubuntu.filesystem.base.dirExists

View file

@ -1,7 +1,7 @@
package io.provs.ubuntu.install.base
import io.provs.Prov
import io.provs.ProvResult
import io.provs.core.Prov
import io.provs.core.ProvResult
private var aptInit = false

View file

@ -1,8 +1,8 @@
package io.provs.ubuntu.keys
import io.provs.Prov
import io.provs.ProvResult
import io.provs.Secret
import io.provs.core.Prov
import io.provs.core.ProvResult
import io.provs.core.Secret
import io.provs.ubuntu.keys.base.configureGpgKeys
import io.provs.ubuntu.keys.base.configureSshKeys
import io.provs.ubuntu.secret.SecretSourceType

View file

@ -1,7 +1,7 @@
package io.provs.ubuntu.keys.base
import io.provs.Prov
import io.provs.ProvResult
import io.provs.core.Prov
import io.provs.core.ProvResult
import io.provs.ubuntu.filesystem.base.createDir
import io.provs.ubuntu.filesystem.base.createFile
import io.provs.ubuntu.filesystem.base.createSecretFile

View file

@ -1,7 +1,7 @@
package io.provs.ubuntu.keys.base
import io.provs.Prov
import io.provs.ProvResult
import io.provs.core.Prov
import io.provs.core.ProvResult
import io.provs.ubuntu.filesystem.base.createDir
import io.provs.ubuntu.filesystem.base.createSecretFile
import io.provs.ubuntu.keys.KeyPair

View file

@ -1,6 +1,6 @@
package io.provs.ubuntu.secret
import io.provs.Secret
import io.provs.core.Secret
import io.provs.ubuntu.secret.secretSources.*
import kotlinx.serialization.Serializable

View file

@ -1,7 +1,7 @@
package io.provs.ubuntu.secret.secretSources
import io.provs.Prov
import io.provs.Secret
import io.provs.core.Prov
import io.provs.core.Secret
import io.provs.ubuntu.secret.SecretSource

View file

@ -1,7 +1,7 @@
package io.provs.ubuntu.secret.secretSources
import io.provs.Prov
import io.provs.Secret
import io.provs.core.Prov
import io.provs.core.Secret
import io.provs.ubuntu.secret.SecretSource

View file

@ -1,7 +1,7 @@
package io.provs.ubuntu.secret.secretSources
import io.provs.Prov
import io.provs.Secret
import io.provs.core.Prov
import io.provs.core.Secret
import io.provs.ubuntu.secret.SecretSource

View file

@ -1,6 +1,6 @@
package io.provs.ubuntu.secret.secretSources
import io.provs.Secret
import io.provs.core.Secret
import io.provs.ubuntu.secret.SecretSource

View file

@ -1,6 +1,6 @@
package io.provs.ubuntu.secret.secretSources
import io.provs.Secret
import io.provs.core.Secret
import io.provs.ubuntu.secret.SecretSource
import java.awt.FlowLayout
import javax.swing.*

View file

@ -1,9 +1,9 @@
package io.provs.ubuntu.user.base
import io.provs.Prov
import io.provs.ProvResult
import io.provs.Secret
import io.provs.processors.RemoteProcessor
import io.provs.core.Prov
import io.provs.core.ProvResult
import io.provs.core.Secret
import io.provs.core.processors.RemoteProcessor
import io.provs.ubuntu.filesystem.base.createDirs
import io.provs.ubuntu.filesystem.base.fileExists
import io.provs.ubuntu.git.provisionGit

View file

@ -1,7 +1,7 @@
package io.provs.ubuntu.utils
import io.provs.escapeBackslash
import io.provs.escapeDoubleQuote
import io.provs.core.escapeBackslash
import io.provs.core.escapeDoubleQuote
// todo: investigate to use .escapeAndEncloseByDoubleQuoteForShell() or similar instead (?)

View file

@ -1,7 +1,7 @@
package io.provs.ubuntu.web.base
import io.provs.Prov
import io.provs.ProvResult
import io.provs.core.Prov
import io.provs.core.ProvResult
import io.provs.ubuntu.install.base.aptInstall
import io.provs.ubuntu.install.base.isPackageInstalled

View file

@ -1,6 +1,6 @@
package io.provs
package io.provs.core
import io.provs.docker.provideContainer
import io.provs.core.docker.provideContainer
import io.provs.test.tags.ContainerTest
import io.provs.test.tags.NonCi
import io.provs.test.testLocal

View file

@ -1,4 +1,4 @@
package io.provs
package io.provs.core
import io.provs.test.defaultTestContainer
import io.provs.test.tags.ContainerTest

View file

@ -1,9 +1,9 @@
package io.provs.docker.platforms
package io.provs.core.docker.platforms
import io.provs.ProvResult
import io.provs.docker.containerRuns
import io.provs.docker.exitAndRmContainer
import io.provs.docker.runContainer
import io.provs.core.ProvResult
import io.provs.core.docker.containerRuns
import io.provs.core.docker.exitAndRmContainer
import io.provs.core.docker.runContainer
import io.provs.test.tags.NonCi
import io.provs.test.testLocal
import org.junit.jupiter.api.Assertions.assertEquals

View file

@ -1,4 +1,4 @@
package io.provs.entry
package io.provs.core.entry
import org.junit.jupiter.api.AfterEach
import org.junit.jupiter.api.Assertions.assertEquals
@ -41,7 +41,7 @@ internal class EntryKtTest {
@Test
fun test_without_method_argument() {
// when
main("io.provs.entry.EntryTestKt")
main("io.provs.core.entry.EntryTestKt")
// then
assertEquals("main is fun \n", outContent.toString())
@ -50,7 +50,7 @@ internal class EntryKtTest {
@Test
fun test_method_main_without_args() {
// when
main("io.provs.entry.EntryTestKt", "main")
main("io.provs.core.entry.EntryTestKt", "main")
// then
assertEquals("main is fun \n", outContent.toString())
@ -59,7 +59,7 @@ internal class EntryKtTest {
@Test
fun test_named_method_without_args() {
// when
main("io.provs.entry.EntryTestKt", "testfun")
main("io.provs.core.entry.EntryTestKt", "testfun")
// then
assertEquals("test is fun \n", outContent.toString())
@ -68,7 +68,7 @@ internal class EntryKtTest {
@Test
fun test_method_main_with_args() {
// when
main("io.provs.entry.EntryTestKt", "main", "arg1", "arg2")
main("io.provs.core.entry.EntryTestKt", "main", "arg1", "arg2")
// then
assertEquals("main is fun arg1 arg2\n", outContent.toString())
@ -77,7 +77,7 @@ internal class EntryKtTest {
@Test
fun test_named_method_with_args() {
// when
main("io.provs.entry.EntryTestKt", "testfun", "arg1", "arg2")
main("io.provs.core.entry.EntryTestKt", "testfun", "arg1", "arg2")
// then
assertEquals("test is fun arg1 arg2\n", outContent.toString())

View file

@ -1,6 +1,6 @@
package io.provs.platformTest
package io.provs.core.platformTest
import io.provs.Prov
import io.provs.core.Prov
import io.provs.test.tags.NonCi
import io.provs.test.testLocal
import org.junit.jupiter.api.Test

View file

@ -1,6 +1,6 @@
package io.provs.platformTest
package io.provs.core.platformTest
import io.provs.Prov
import io.provs.core.Prov
import io.provs.test.testLocal
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test

View file

@ -1,5 +1,6 @@
package io.provs
package io.provs.core.processors
import io.provs.core.newline
import io.provs.test.defaultTestContainer
import io.provs.test.tags.ContainerTest
import org.junit.jupiter.api.Assertions.assertEquals

View file

@ -1,6 +1,6 @@
package io.provs.processors
package io.provs.core.processors
import io.provs.platforms.SHELL
import io.provs.core.platforms.SHELL
import io.provs.test.DEFAULT_START_MODE_TEST_CONTAINER
import io.provs.test.tags.ContainerTest
import io.provs.test.testDockerWithSudo

View file

@ -1,5 +1,9 @@
package io.provs
package io.provs.core.processors
import io.provs.core.Prov
import io.provs.core.escapeAndEncloseByDoubleQuoteForShell
import io.provs.core.escapeProcentForPrintf
import io.provs.core.escapeSingleQuoteForShell
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.api.Test
@ -21,7 +25,7 @@ internal class LocalProcessorTest {
// then
assert(res.success)
assert(res.out == text)//"abc123!§\\$%&/\"\\äöü'")
assert(res.out == text)
}

View file

@ -1,35 +1,23 @@
package io.provs.ubuntu.extensions.server_software.firewall
import io.provs.Prov
import io.provs.docker.dockerProvideImage
import io.provs.docker.exitAndRmContainer
import io.provs.docker.images.UbuntuPlusUser
import io.provs.local
import io.provs.processors.ContainerEndMode
import io.provs.processors.ContainerStartMode
import io.provs.processors.ContainerUbuntuHostProcessor
import io.provs.core.Prov
import io.provs.core.docker.dockerProvideImage
import io.provs.core.docker.dockerimages.UbuntuPlusUser
import io.provs.core.docker.exitAndRmContainer
import io.provs.core.local
import io.provs.core.processors.ContainerEndMode
import io.provs.core.processors.ContainerStartMode
import io.provs.core.processors.ContainerUbuntuHostProcessor
import io.provs.test.tags.NonCi
import io.provs.ubuntu.install.base.aptInstall
import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test
internal class ProvisionFirewallKtTest {
@Test
@Disabled
fun provisionFirewall() {
// todo
}
@Test
@Disabled
fun resetFirewall() {
// todo
}
@Test
@NonCi
fun configureFirewall() {
// given
val dockerImage = UbuntuPlusUser()

View file

@ -1,6 +1,7 @@
package io.provs.ubuntu.extensions.server_software.nginx
import io.provs.test.defaultTestContainer
import io.provs.test.tags.NonCi
import io.provs.ubuntu.filesystem.base.replaceTextInFile
import io.provs.ubuntu.install.base.aptInstall
import io.provs.ubuntu.extensions.server_software.nginx.base.*
@ -12,6 +13,7 @@ import org.junit.jupiter.api.Test
internal class ProvisionNginxKtTest {
@Test
@NonCi
fun provisionNginxStandAlone_customConfig() {
// given
val a = defaultTestContainer()
@ -40,6 +42,7 @@ internal class ProvisionNginxKtTest {
}
@Test
@NonCi
fun provisionNginxStandAlone_defaultConfig() {
// given
val a = defaultTestContainer()
@ -54,6 +57,7 @@ internal class ProvisionNginxKtTest {
}
@Test
@NonCi
fun provisionNginxStandAlone_sslConfig() {
// given
val a = defaultTestContainer()

View file

@ -8,10 +8,12 @@ import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.api.Test
import io.provs.test.defaultTestContainer
import io.provs.test.tags.NonCi
internal class LocationsKtTest {
@Test
@NonCi
fun nginxIncludeLocationFolders() {
// given
val a = defaultTestContainer()

View file

@ -1,6 +1,6 @@
package io.provs.ubuntu.extensions.workplace
import io.provs.Password
import io.provs.core.Password
import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.api.Test
import io.provs.test.defaultTestContainer

View file

@ -1,10 +1,10 @@
package io.provs.ubuntu.extensions.workplace.base
import io.provs.Prov
import io.provs.ProvResult
import io.provs.Secret
import io.provs.docker.exitAndRmContainer
import io.provs.local
import io.provs.core.Prov
import io.provs.core.ProvResult
import io.provs.core.Secret
import io.provs.core.docker.exitAndRmContainer
import io.provs.core.local
import io.provs.test.defaultTestContainer
import io.provs.test.tags.ContainerTest
import io.provs.test.tags.NonCi

View file

@ -1,7 +1,7 @@
package io.provs.ubuntu.extensions.workplace.base
import io.provs.Secret
import io.provs.remote
import io.provs.core.Secret
import io.provs.core.remote
import io.provs.test.defaultTestContainer
import io.provs.test.tags.ContainerTest
import io.provs.ubuntu.filesystem.base.*
@ -39,7 +39,7 @@ internal class GopassKtTest {
// when
val res = a.installGopass()
val res2 = a.configureGopass(a.userHome() + ".password-store")
val res2 = a.configureGopass(a.userHome() + gopassRootDir)
val res3 = a.gopassMountStore("exampleStore", "~/exampleStoreFolder")
// then

View file

@ -1,6 +1,6 @@
package io.provs.ubuntu.keys
import io.provs.Secret
import io.provs.core.Secret
import io.provs.test.defaultTestContainer
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.condition.EnabledOnOs

View file

@ -1,7 +1,7 @@
package io.provs.ubuntu.keys.base
import io.provs.Prov
import io.provs.Secret
import io.provs.core.Prov
import io.provs.core.Secret
import io.provs.test.defaultTestContainer
import io.provs.test.tags.ContainerTest
import io.provs.ubuntu.keys.KeyPair

View file

@ -1,6 +1,6 @@
package io.provs.ubuntu.keys.base
import io.provs.Secret
import io.provs.core.Secret
import io.provs.test.defaultTestContainer
import io.provs.ubuntu.keys.*
import org.junit.jupiter.api.Test

View file

@ -1,6 +1,6 @@
package io.provs.ubuntu.utils
import io.provs.Prov
import io.provs.core.Prov
import io.provs.test.tags.ContainerTest
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test

View file

@ -1,12 +1,12 @@
package io.provs.test
import io.provs.ProgressType
import io.provs.Prov
import io.provs.docker.dockerImageExists
import io.provs.docker.dockerProvideImage
import io.provs.docker.images.UbuntuPlusUser
import io.provs.processors.ContainerStartMode
import io.provs.processors.ContainerUbuntuHostProcessor
import io.provs.core.ProgressType
import io.provs.core.Prov
import io.provs.core.docker.dockerImageExists
import io.provs.core.docker.dockerProvideImage
import io.provs.core.docker.dockerimages.UbuntuPlusUser
import io.provs.core.processors.ContainerStartMode
import io.provs.core.processors.ContainerUbuntuHostProcessor
val DEFAULT_START_MODE_TEST_CONTAINER = ContainerStartMode.USE_RUNNING_ELSE_CREATE