When sending the configuration to the puppet agent, I get an error - linux

When sending the configuration to the agent, I get an error Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Function Call, no implicit conversion of String into Integer (file:/etc/puppetlabs/code/environments/production/modules/accounts/manifests/init.pp, line: 24, column: 24) on node
init.pp
**# See README.md for details.**
class accounts(
$groups = {},
$groups_membership = undef,
$ssh_keys = {},
$users = {},
$usergroups = {},
$accounts = {},
$start_uid = undef,
$start_gid = undef,
$purge_ssh_keys = false,
$ssh_authorized_key_title = '%{ssh_key}-on-%{account}',
$shell = undef,
$managehome = true,
$forcelocal = true,
) {
include ::accounts::config
create_resources(group, $groups)
create_resources(accounts::account, $accounts)
** # Remove users marked as absent**
$absent_users = keys(absents($users))
user { $absent_users:
ensure => absent,
managehome => $managehome,
forcelocal => $forcelocal,
}
}
_______________________________________________________________________________________________
I'm new to puppet and using it together with foreman
Puppet master version 7.2.0
Puppet agent version 6.27.0
Foreman version 3.4.0
All settings were made in Foreman. Manifests, like any other changes, were not made in the console.

Related

Getting "error TS2307: Cannot find module" when deploynig code using ml-gradle

When I trying to deploying the code on ml server(10.0-9.4) ,with below build.gradle file , we are getting the below mentioned error:
In this deployment, I want to avoid the loading of ts(src/test/rule10.test.ts) file , is there any way to do so as it is not required and dependent on other modules.
command used :
./gradlew -b build.gradle loadRules -i -PmlUsername="" -PmlPassword="" -PmlHost="localhost"
build.gradle
plugins {
// node
// id "com.moowork.node" version "1.1.1"
// ML-Gradle will handle the marklogic configuration
id 'com.marklogic.ml-gradle' version '4.1.0'
id "com.github.node-gradle.node" version "3.1.1"
}
// Set up extra properties to configure ml-gradle
ext {
// set up the default IDDN databases
mlAppConfig {
contentDatabaseName = 'data1'
schemasDatabaseName = 'Schemas'
modulesDatabaseName = 'Modules'
triggersDatabaseName = 'Triggers'
}
mlAppDeployer.getCommand('DeployCustomForestsCommand').setCustomForestsPath("forests")
// mlAppDeployer.getCommands().remove(mlAppDeployer.getCommand("DeployRolesCommand"))
// do not let ml-gradle create a default rest server - we will only use the json config files
mlAppDeployer.getCommands().remove(mlAppDeployer.getCommand('DeployRestApiServersCommand'))
}
repositories {
mavenCentral()
// Needed for mlcp dependencies
maven { url 'https://developer.marklogic.com/maven2/' }
}
configurations {
mlcp
}
dependencies {
mlcp 'com.marklogic:mlcp:10.0.9.2'
mlcp files('lib')
}
// Control nodejs and NPM build tasks via gradle
node {
// Version of node to use.
version = '10.14.1'
npmVersion = '6.4.1'
download = true
}
// do not spam NPM error messages, the tools' own messages are fine.
npm_run_clean {
args = ['--loglevel', 'silent']
}
npm_run_build {
args = ['--loglevel', 'silent']
}
npm_run_test {
args = ['--loglevel', 'silent']
}
task loadJSON(type: com.marklogic.gradle.task.MlcpTask, dependsOn: []) {
classpath = configurations.mlcp
command = 'IMPORT'
database = 'Modules'
input_file_path = './src/main/ml-modules/root/a1.json'
document_type = 'json'
output_uri_replace = "^.*root,''"
}
// temp workaround to facilitate ns and collections
task loadJS(type: com.marklogic.gradle.task.MlcpTask, dependsOn: [npm_run_clean, npm_run_build]) {
classpath = configurations.mlcp
command = 'IMPORT'
database = 'Modules'
input_file_path = './src/main/ml-modules/root'
document_type = 'text'
output_uri_replace = "^.*root,''"
}
task loadRules(type: com.marklogic.gradle.task.MlcpTask, dependsOn: [mlClearModulesDatabase, mlClearSchemasDatabase, mlLoadSchemas, loadJS, loadJSON]) {
classpath = configurations.mlcp
command = 'IMPORT'
database = 'Modules'
input_file_path = './src/main/ml-modules/root'
document_type = 'text'
output_uri_replace = "^.*root,''"
output_uri_suffix = ".sjs"
}
mlLoadSchemas.mustRunAfter(mlClearSchemasDatabase)
npm_run_build{}.mustRunAfter(npm_run_clean)
loadJS.mustRunAfter(npm_run_build)
loadJS.mustRunAfter(mlClearModulesDatabase)
loadJSON.mustRunAfter(loadJS)
loadRules.mustRunAfter(loadJS)
error:
> Task :npm_run_build
Caching disabled for task ':npm_run_build' because:
Build cache is disabled
Task ':npm_run_build' is not up-to-date because:
Task has not declared any outputs despite executing actions.
Starting process 'command '/var/opt/redaction/.gradle/npm/npm-v6.4.1/bin/npm''. Working directory: /var/opt/redaction Command: /var/opt/redaction/.gradle/npm/npm-v6.4.1/bin/npm run build --loglevel silent
Successfully started process 'command '/var/opt/redaction/.gradle/npm/npm-v6.4.1/bin/npm''
src/test/rule12.test.ts(3,38): error TS2307: Cannot find module 'marklogic-test-harness'.
src/test/rule11.test.ts(3,33): error TS2307: Cannot find module 'marklogic-test-harness'.
src/test/rule10.test.ts(2,38): error TS2307: Cannot find module 'marklogic-test-harness'.
src/test/test7.ts(3,33): error TS2307: Cannot find module 'marklogic-test-harness'.
src/test/test5.ts(3,36): error TS2307: Cannot find module 'marklogic-test-harness'.
src/test/rule3.test.ts(3,33): error TS2307: Cannot find module 'marklogic-test-harness'.
src/test/rule2.test.ts(2,38): error TS2307: Cannot find module 'marklogic-test-harness'.
src/test/rule.test.ts(3,33): error TS2307: Cannot find module 'marklogic-test-harness'.
src/test/rule1.test.ts(3,33): error TS2307: Cannot find module 'marklogic-test-harness'.
> Task :npm_run_build FAILED
:npm_run_build (Thread[Execution worker for ':',5,main]) completed. Took 3.295 secs.
Please any one can help me on this.
You could look to apply properties to only include (or to exclude) certain module filename patterns:
https://github.com/marklogic-community/ml-gradle/wiki/Property-reference#module-and-schema-properties
mlModulesRegex New in 3.3.0 - when running mlLoadModules or mlReloadModules, only load modules with a file path matching the given regex pattern. No default value.
mlResourceFilenamesToExcludeRegex New in 3.0.0 - regex that defines resource filenames to exclude from processing (exclude = ignore). Useful for when you want to exclude a set of resources when deploying to a certain environment. Cannot be set when mlResourceFilenamesToIncludeRegex is also set. No default value.

Puppet Duplicate declaration: Class[main] is already declared

I am trying to setup my puppet modules and apply. And I get the below error:
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Duplicate declaration: Class[main] is already declared; cannot redeclare (file: /mnt/wso2puppet/dev/manifests/site.pp, line: 24) (file: /mnt/wso2puppet/dev/manifests/site.pp, line: 24, column: 3) on node test-mi-integrator
And here's my /mnt/wso2puppet/dev/manifests/site.pp
...
# Run stages
stage { 'custom': }
# Order stages
Stage['main'] -> Stage['custom']
node default {
class { "::${::profile}": }
class { "::${::profile}::custom":
stage => 'custom'
}
}
Can someone help me what is wrong here?

Failed to load manifest for dependency

I am trying to import some primitives into pallet in substrate but when I execute cargo check I get this error: failed to load manifest for dependency 'name of primitives'
Dex pallet: https://github.com/Kabocha-Network/cumulus/tree/v0.9.13-elio/pallets/dex
Can somebody please take a look and let me know. Thank you in advance.
if you run cargo check you get:
error: failed to load manifest for workspace member `/root/cumulus/pallets/dex`
Caused by:
failed to load manifest for dependency `acala-primitives`
Caused by:
failed to load manifest for dependency `module-evm-utiltity`
Caused by:
failed to read `/root/cumulus/primitives/modules/evm-utiltity/Cargo.toml`
Caused by:
No such file or directory (os error 2)
The problem is that /root/cumulus/primitives/modules/evm-utiltity/Cargo.toml, is not found because you haven't included this pallet locally or the pallet is misplaced and located somewhere else.
Simple solutions:
1. Locate and correct
Find where the pallet is and correctly link to it, or import the pallet to the location root/cumulus/primitives/modules/evm-utiltity/Cargo.toml so it can be found.
2. Externally linking rather than importing pallets locally.
You can link to the pallet from its external source rather than importing it locally, otherwise you will find you need to take many more dependencies and store them locally just like the /root/cumulus/primitives/modules/evm-utiltity/Cargo.toml mentioned above in the error.
What you can do instead is:
Go directly to the runtime directory, which is /root/cumulus/parachain-template/runtime/Cargo.toml and link to the external dex directly from github.com/acala-network/acala
something like this:
[dependencies.pallet-dexl]
default-features = false
git = 'https://github.com/Acala-Network/acala.git'
branch = polkadot-v0.9.13
version = '3.0.0'
or actually it is still using the older dependency version, which will be like:
pallet-dex = { git = "https://github.com/Acala-Network/acala", default-features = false, branch = "polkadot-v0.9.13" }
and more specifically for this error:
module-evm-utlity = { git = "https://github.com/Acala-Network/acala", default-features = false, branch = "polkadot-v0.9.13" }
but if you link to pallet-dex from its external source, the error should disappear and you will probably not need to link acala-primitives or module-evm-utility.
https://docs.substrate.io/how-to-guides/v3/basics/pallet-integration/
also, evm-utiltity is not spelled correctly (utility).
My fix for this error was setting the correct branch value, from .17 to .18 in my pallets cargo.toml file. For the sp-io dependency I had branch = "polkadot-v0.9.17" which didn't match the polkadot-v0.9.18 version every other dependency is on.
Original with problem on sp-io (last line)
[dependencies]
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = [
"derive",
] }
scale-info = { version = "2.0.1", default-features = false, features = ["derive"] }
frame-support = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.18"}
frame-system = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.18" }
frame-benchmarking = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.18", optional = true }
sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.17" }
Fix (sp-io)
sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.18" }
Now the "branch" matches with everything else and my errors are gone! Back to the Substrate Kitties tutorial I go!

looping in Puppet 5 results in duplicate declaration error

Request some help please.
Requirement is to create a custom firewall service and then allow this custom firewall service only to a selected ips (trying to use firewalld_rich_rules here).
Here is the sample code:
class foo::fwall (
$sourceip = undef,
)
{
include firewalld
if $sourceip {
$sourceip.each |String $ipaddr| {
firewalld_rich_rule { "rich_rule_${ipaddr}":
ensure => enabled,
permanent => true,
zone => 'public',
family => ipv4,
source => $ipaddr,
element => service,
servicename => 'bar',
action => accept,
}
}
}
# this is defined in firewalld class and works good
firewalld::custom_service { 'bar':
short => 'bar custom service',
description => 'custom service ports',
ports => [
{
port => '7771',
protocol => 'tcp',
},
{
port => '8282',
protocol => 'tcp',
},
{
port => '8539',
protocol => 'tcp',
},
],
}
}
and while running it on a node, with couple of ip addresses (provided as an array for $sourceip), it results in duplicate declaration error
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Resource Statement, Duplicate declaration: Firewalld_rich_rule[rich_rule_2] is already declared at (file: .../dev/modules/test/manifests/fwall.pp, line: 11); cannot redeclare (file: .../dev/modules/test/manifests/fwall.pp, line: 11) (file: .../dev/modules/test/manifests/fwall.pp, line: 11, column: 7) on node server.domain
Trying it in puppet v5.5 (from puppetlabs) for Redhat Enterprise Linux 7 servers
Note: tried defining a resource following this example from Puppet documentation but getting invalid address error.
define puppet::binary::symlink ($binary = $title) {
file {"/usr/bin/${binary}":
ensure => link,
target => "/opt/puppetlabs/bin/${binary}",
}
}
Use the defined type for the iteration somewhere ele in your manifest file:
$binaries = ['facter', 'hiera', 'mco', 'puppet', 'puppetserver']
puppet::binary::symlink { $binaries: }
I had to change the datatype for $sourceip to array in RH Satellite's smart class parameters which was String by default. Everything works good now.

Snoopy module in Puppet returns "Could not find declared class snoopy::install"

I am getting an error on the snoopy module. When I run it on my client, I am getting this error:
"Error: Could not retrieve catalog from remote server: Error 400 on SERVER:
Puppet::Parser::AST::Resource failed with error ArgumentError: Could not find declared class snoopy::install at /etc/puppet/modules/snoopy/manifests/init.pp:22 on node <hostname>
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run"
Any ideas what I am doing wrong here? This is the snoopy module from git with a couple of modifications for our environment. https://forge.puppet.com/revolutionsystem/snoopy
install.pp
$ cat install.pp
# snoopy::install
#
# A description of what this class does
#
# #summary A short summary of the purpose of this class
#
# #example
# include snoopy::install
class snoopy::install {
# Download snoopy installation script
file { '/tmp/snoopy':
ensure => directory,
owner => 'root',
group => 'root',
mode => '0755',
} ->
exec { 'wget installer':
command => "/usr/bin/wget http://159.79.213.28/pub/PUPPET/snoopy- install.sh",
creates => "/tmp/snoopy/snoopy-install.sh",
require => [ File['/tmp/snoopy'], ];
} ->
# Install Snoopy stable version
exec { '/tmp/snoopy/snoopy-install.sh stable':
cwd => '/tmp/snoopy',
command => '',
path => [ '/bin/bash' ],
unless => [ 'test -f /tmp/snoopy/snoopy-install.sh']
require => [ File['/tmp/snoopy'], File['/tmp/snoopy/snoopy- install.sh'], ];
}
}'
$ cat init.pp
# snoopy
#
# A description of what this class does
#
# #summary A short summary of the purpose of this class
#
# #example
# include snoopy
class snoopy (
$user_name = $::snoopy::params::username,
$user_id = $::snoopy::params::userid,
$group_id = $::snoopy::params::groupid,
$super_id = $::snoopy::params::superid,
$terminal = $::snoopy::params::terminal,
$current_directory = $::snoopy::params::currentdirectory,
$process_id = $::snoopy::params::processid,
$file_name = $::snoopy::params::filename,
$log_file = $::snoopy::params::logfile,
$log_path = $::snoopy::params::logpath,
$date_time = $::snoopy::params::datetime
) inherits snoopy::params {
class { 'snoopy::install': }
class { 'snoopy::configure':
username => $user_name,
userid => $user_id,
groupid => $group_id,
superid => $super_id,
terminal => $terminal,
currentdirectory => $current_directory,
processid => $process_id,
filename => $file_name,
logfile => $log_file,
logpath => $log_path,
datetime => $date_time
}
}
This can bel closed, it is related to the version of puppet agent we are running. Module required version >= 4.0.0 and <= 6.0.0.
We are running 3.8.x.

Resources