I'm making a test manifest for puppet to install a package with choclatey provider from forge.
If I apply with the file test.pp with the code:
class test {
include chocolatey
if $::kernel == 'windows' {
Package {
provider => chocolatey,
}
}
package { '7zip':
ensure => installed,
}
}
Is not working and chocolatey doesn't install anything, but if I try without the class with the code:
include chocolatey
if $::kernel == 'windows' {
Package {
provider => chocolatey,
}
}
package { '7zip':
ensure => installed,
}
Why? In the first option, why is not working?
I was using the test.pp with puppet apply --test test.pp but the first code I was only declarating the class but not using it. This code works:
class test {
include chocolatey
if $::kernel == 'windows' {
Package {
provider => chocolatey,
}
}
package { '7zip':
ensure => installed,
}
}
include test
Related
I have two github pacakges named XXX/AAA and YYY/BBB (same OWNER but different repository).
Now, when I try to add them into my project, gradle always seem to use the 1st repository.
repositories {
maven { url 'https://jitpack.io' }
maven {
url "https://maven.pkg.github.com/XXX/AAA"
credentials {
username = USERNAME
password = PWD
}
}
maven {
url "https://maven.pkg.github.com/XXX/BBB"
credentials {
username = USERNAME
password = PWD
}
}}
And com.example in implementation is also same.
dependencies {
// implementation 'com.example:package'
// AAA
implementation("YYY:AAA:${a_version}")
// BBB
implementation("YYY:BBB:${b_version}")
}
and I receive the following error while syncing
Could not HEAD 'https://maven.pkg.github.com/XXX/AAA/YYY/BBB/0.1/BBB-0.1.pom'. Received status code 400 from server: Bad Request. Disable Gradle 'offline mode' and sync project
As we can clearly see, gradle uses the wrong repository(AAA instead of BBB)
Any help is appreciated.
Thanks in advance
You need to declare these repositories as exclusive for the respectful dependencies:
repositories {
maven { url 'https://jitpack.io' }
exclusiveContent {
forRepository {
maven {
url 'https://maven.pkg.github.com/XXX/AAA'
credentials {
username = "USERNAME"
password = "PWD"
}
}
}
filter {
includeModule("YYY", "AAA")
}
}
exclusiveContent {
forRepository {
maven {
url 'https://maven.pkg.github.com/XXX/BBB'
credentials {
username = "USERNAME"
password = "PWD"
}
}
}
filter {
includeModule("YYY", "BBB")
}
}
}
I want to use fluentvalidation to automatically verify exceptions, but I can’t do this now. If I put the Validator in the same one project, it will work, but if I put it Validator in another library, it will not work。
The following project one
public class TestValidator : AbstractValidator<WeatherForecast>
{
public TestValidator()
{
RuleFor(x => x.Summary).NotEmpty().WithMessage("Username or email are required");
}
}
The following project two
I said that registration and verification are placed in different projects, which leads to abnormal verification.
services.AddMvc(options =>
{
options.Filters.Add(new ExceptionFilter());
})
.AddFluentValidation(options =>
{
options.RegisterValidatorsFromAssemblyContaining<Startup>();
});
You need change your startup to :
.AddFluentValidation(options =>
{
options.RegisterValidatorsFromAssemblyContaining<TestValidator>();
});
Test result:
I am building a kotlin MPP Library targeting JVM, Windows, JS and MacOS.
My gradle file looks like this for the JS
kotlin {
targets {
jvm()
js {
browser {
}
nodejs {
}
}
mingwX64("windows") {
binaries {
sharedLib {
baseName = "lib"
}
staticLib {
baseName = "lib"
}
}
}
macosX64("macos") {
binaries {
sharedLib {
baseName = "lib"
}
}
}
sourceSets {
commonMain {
dependencies {
implementation(kotlin("stdlib-common"))
implementation("org.kodein.di:kodein-di:$kodeinVersion")
}
}
commonTest {
dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
implementation("io.mockk:mockk-common:$mockkVersion")
}
}
getByName("jvmMain").dependencies {
implementation(kotlin("stdlib-jdk8"))
}
getByName("jvmTest").dependencies {
implementation(kotlin("test"))
implementation(kotlin("test-junit"))
implementation("io.mockk:mockk:$mockkVersion")
}
getByName("jsMain").dependencies {
implementation(kotlin("stdlib-js"))
}
getByName("jsTest").dependencies {
implementation(kotlin("test-js"))
}
getByName("macosMain").dependencies {
}
getByName("macosTest").dependencies {
}
getByName("windowsMain").dependencies {
}
getByName("windowsTest").dependencies {
}
}
}
sourceSets {
all {
languageSettings.enableLanguageFeature("InlineClasses")
}
}
configure(listOf(metadata(), jvm(), js(), macosX64("macos"), mingwX64("windows"))) {
mavenPublication {
val targetPublication = this#mavenPublication
tasks.withType<AbstractPublishToMaven>()
.matching { it.publication == targetPublication }
}
}
}
task("generateJsPackageJson") {
doLast {
File("$buildDir/js/packages/${project.name}/kotlin", "package.json")
.writeText(
"""{
"name": "#org/${project.name.toLowerCase()}",
"version": "$version",
"main": "${project.name}.js",
"url": "https://gitlab.com/org/common/multiplatform/lib",
"dependencies": {
"kotlin": "^${kotlin.coreLibrariesVersion}"
},
"publishConfig": {
"#org:registry":"https://gitlab.com/api/v4/projects/${System.getenv("CI_PROJECT_ID")}/packages/npm/"
}
}
"""
)
}
}
The consumer of my library on JS install the package using npm from our GitLab registry and tha works fine. The issue they are experiencing is the following:
Uncaught Error: Cannot find module 'Kodein-DI-kodein-di'
Require stack:
- /tmp/test-lib/node_modules/#org/lib/Index.js
- <repl>
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
at Function.Module._load (internal/modules/cjs/loader.js:841:27)
at Module.require (internal/modules/cjs/loader.js:1025:19)
at require (internal/modules/cjs/helpers.js:72:18)
at /tmp/test-lib/node_modules/#org/lib/Index.js:5:48 {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/tmp/test-lib/node_modules/#org/lib/Index.js',
'<repl>'
]
}
How can I hide my dependency to Kodein to my JS clients? My understanding of how gradle dependency management works is that using implementation is supposed to add the dependency at compile and runtime but just for you module and not for its external clients.
Does this happen because I'm using KodeIN in non internal packages and classes of my Lib?
It is because Kodein is Gradle (Maven) dependency, which is not presented in NPM registry.
You generate package.json with only Kotlin dependency, but without Kodein (and you can't because as I know, there is not Kodein in NPM).
In fact you need to distribute it with your code, because otherwise, you will get such ReferenceError
You can for example put you dependencies into node_modules dir inside you npm package.
Now we are working on Kotlin/JS IR compiler, which is based on closed world model, and which will produce JavaScript file with all Kotlin libraries bundled (but with possibility to share some in case). And you can try it with you project (if you dependencies have IR variant)
I created a free artifactory server on Google Cloud and I'm trying to deploy it, but I have the following error:
Execution failed for task ':artifactoryDeploy'.
java.io.IOException: Could not publish build-info: This plugin is compatible with version 2.2.3 of Artifactory and above. Please upgrade
your Artifactory server!
My Gradle config
import groovy.lang.GroovyObject
import org.jfrog.gradle.plugin.artifactory.dsl.PublisherConfig
plugins {
kotlin("jvm") version "1.4.10"
id("com.jfrog.artifactory") version "4.17.2"
`maven-publish`
}
group = "com.rjdesenvolvimento"
version = "0.0.1"
repositories {
jcenter()
maven { url = uri("https://kotlin.bintray.com/ktor") }
}
dependencies {
implementation(kotlin("stdlib"))
api("org.junit.jupiter:junit-jupiter-engine:5.7.0")
api("org.jetbrains.kotlin:kotlin-test-junit5:1.4.10")
api("io.mockk:mockk:1.10.2")
}
tasks {
compileKotlin { kotlinOptions.jvmTarget = "11" }
compileTestKotlin { kotlinOptions.jvmTarget = "11" }
}
publishing {
publications {
create<MavenPublication>("kotlin") {
from(components["kotlin"])
}
}
}
artifactory {
setContextUrl("https://some-addressjfrog.io/artifactory/artifact/")
publish(delegateClosureOf<PublisherConfig> {
repository(delegateClosureOf<GroovyObject> {
setProperty("repoKey", "aries-develop")
setProperty("username", "some-user")
setProperty("password", "some=password")
setProperty("maven", true)
})
})
}
The issue is with using a wrong Artifactory URL (as indicated by #yahavi in the comments).
Please make sure that you are using the root Artifactory context, for example:
https://some-address.jfrog.io/artifactory/
The error message from the plugin is misleading and is updated in version 3.9.0 of the Jenkins Artifactory plugin.For more details see this Github issue.
Can someone tell me how to install Cloudinary to my Strapi app, I installed the plugin like the documentation said but the plugin doesn't show up at all in my project. Can someone tell me what im doing wrong
There is an example on the strapi documentation:
https://strapi.io/documentation/3.0.0-beta.x/plugins/upload.html#using-a-provider
To enable the provider for Cloudinary, create or edit the file at ./extensions/upload/config/settings.json
{
"provider": "cloudinary",
"providerOptions": { "cloud_name":"PROVIDER_CLOUD_NAME",
"api_key": "PROVIDER_API_KEY",
"api_secret":"PROVIDER_API_SECRET"
}
}
Of course you should replace PROVIDER_CLOUD_NAME, PROVIDER_API_KEY, PROVIDER_API_SECRET with appropriate values that can be found on your Cloudinary account.
If you want a specific configuration by environment you can edit the file at ./extensions/upload/config/settings.js like this:
if (process.env.NODE_ENV === 'production') {
module.exports = {
provider: 'providerName',
providerOptions: {
cloud_name: process.env.PROVIDER_CLOUD_NAME,
api_key: process.env.PROVIDER_API_KEY,
api_secret: process.env.PROVIDER_API_SECRET
}
};
} else {
// to use the default local provider you can return an empty configuration
module.exports = {};
}