Puppet : Warning: Only one file can be applied per run. Skipping - puppet

I'm installing an application called "Bag Of Holding" using the puppet script provided on github. I installed successfully then needed to make a change to the site.pp and init.pp file but when I tried to recompile using (puppet apply ), I got the warning message
Warning: Only one file can be applied per run. Skipping /etc/puppet/manifests/site.pp
And no other activity on the screen. I was unable to access my application after that. After a day of troubleshooting I gave up and started from scratch - re-install my CentOS, puppet, and all the folder directories were in place, but as soon I run "puppet apply", I got the same Warning as previously and I have since not been able to access the application.
How could the compilation fail for a newly installed operating system with application being installed freshly? Is it not possible to run puppet site.pp file more than once? Is there anything hard coded to the server after the first run and can no longer accept additional compilation? Both site.pp and init.pp file are on the github I posted above. I'm running masterless puppet configuration set up.
site.pp code:
# adding boh module to the node
node 'boh.domain' {
class { 'boh':
python_version => 3,
environment => 'dev',
language => 'pt-br',
debug => 'True',
create_superuser => 'true',
pkg_checksum => '86b0164f7fd6c5e4aa43c8f056f08cea',
}
}

Question no longer relevant. I found the fix by ensuring appropriate syntax was being used...puppet apply -
-- modulepath=
Thanks

Related

Is there any way to skip hoisting during yarn build?

Recently I have updated the node version to 16+. Prior to that, I was able to trigger the yarn build command to create the build of my project.
But after installation of node 16+, the yarn build command is throwing the following errors
./lib/view-registration.js
Module not found: Error: Can't resolve 'hoisted/#msdyn365-commerce-modules/wishlist/dist/lib/modules/wishlist-items/wishlist-items.view.js' in 'H:\source\D365_eCommerce\lib'
# ./lib/view-registration.js 5:112769-113063
# ./node_modules/#msdyn365-commerce/bootloader/entry/client.js
# multi ./node_modules/#msdyn365-commerce/bootloader/entry/webpack-public-path.js ./node_modules/#msdyn365-commerce/bootloader/entry/client
It seems like it is trying to pick the module from the hoisted folder.
I am new to this concept so have no idea why it is targeting this folder in spite of this it should pick the module from '#msdyn365-commerce-modules/wishlist/dist/lib/modules/wishlist-items/wishlist-items.view.js' directly.
Any explanation would be appreciated.
How can I force it to not pick the module directly from the hoisted folder and use '#msdyn365-commerce-modules/wishlist/dist/lib/modules/wishlist-items/wishlist-items.view.js' directly
Thanks,
Aman
This issue mainly occurred due to the corrupt version of Node.
The only possible solution for this is to make sure that all the dependencies required for Node (16+) are also installed.
We can either download all the dependencies manually or just need to allow the node itself to download all the dependencies at the time of installation.
Thanks,
Aman

Unable to build Angular project in Alpine Linux

I've recently migrated my project to Angular 13. It builds locally on my Mac, however it's started to fail when I run it in my Docker build container (tested both locally and on our CI/CD server.
It's complaining about the DeckGL import:
Cannot find module '#deck.gl/layers' or its corresponding type declarations.
1 import * as Layers from '#deck.gl/layers';
Cannot find module '#deck.gl/geo-layers' or its corresponding type declarations.
2 import * as GeoLayers from '#deck.gl/geo-layers';
Cannot find module '#deck.gl/aggregation-layers' or its corresponding type declarations.
3 import * as AggregationLayers from '#deck.gl/aggregation-layers';
I've used npm list to ensure the dependencies are the same on my Mac and within the Alpine container and have also tested using the same Node version (and have tried a couple of different Node / Apline images), however, the issue persists, whilst still working locally.
Any ideas what could be causing this?
Really silly issue, but posting an answer in case someone runs into a similar issue in future.
I had accidentally run npm install in a top-level directory, and had installed some Node modules that didn't end up in my package.json file. In my case, I had the core deck.gl module installed in my package.json, but none of the layer packages (which are separate npm modules).
When I was running it locally, it was finding the correct dependency, but when running it on the CI/CD environment, it was obviously failing.

Is there a way to place a try/catch block around an import in Groovy?

I'm currently trying to write a piece of Groovy code that I want to act differently on one machine versus another. There are some libraries that aren't available on another machine, so my thought was that I'd do a try/catch block like so:
import org.codehaus.groovy.control.MultipleCompilationErrorsException
def importStuff() {
try {import static java.lang.String.format}
} catch (MultipleCompilationErrorsException) {
println("import failed.")
}
importStuff()
However, this fails with the following: 4: Unexpected input: 'import' # line 4, column 10. In Python, there's syntax like:
try:
import moduledoesntexist
except:
print("module does not exist.")
and if run, would give the output:
>>> module does not exist.
Would there be a way to recreate this type of behavior in Groovy?
Is there a way to place a try/catch block around an import in Groovy?
No.
You can manage your dependencies (thus support any imports) inside Groovy scripts using a built-in dependencies management system called Grape. This way you can create a Groovy script that runs everywhere. Consider the following example:
#Grab('io.ratpack:ratpack-groovy:1.9.0')
#Grab('org.slf4j:slf4j-simple:1.7.30')
import static ratpack.groovy.Groovy.ratpack
ratpack {
handlers {
get {
render 'Hello World from Ratpack with Groovy!!'
}
}
}
This is a Groovy script that with just a few lines of code starts Ratpack HTTP server on port 5050.
$ groovy -version
Groovy Version: 2.5.4 JVM: 1.8.0_292 Vendor: Amazon.com Inc. OS: Linux
$ groovy ratpackscript.groovy
[main] INFO ratpack.server.RatpackServer - Starting server...
[main] INFO ratpack.server.RatpackServer - Building registry...
[main] INFO ratpack.server.RatpackServer - Ratpack started (development) for http://localhost:5050
Both dependencies (ratpack-groovy and slf4j-simple) with their transitive dependencies are downloaded the first time you run the script (keep in mind it may take some time to download all required JAR files.)
Solving problems with downloading dependencies
Sometimes you may run into some problems with downloading dependencies, but it happens mostly because of the broken files in the local repository. Grape checks your local ~/.m2/repository and ~/.groovy/grapes folders, and if any dependency is broken in any of these directories you will see some error with the name of the dependency that cannot be downloaded. Removing the folder of that dependency in both locations solves that problem. (You don't have to remove the folder with the name of the dependency, but rather a folder with specific version of that dependency inside of that folder.)

How to install Gin with Golang

I'm a newbie on Golang, and I'm trying to use Gin to develop a web server on Ubuntu 16.04.
After executing go get -u github.com/gin-gonic/gin, many folders appear at ~/go/pkg/mod/github.com/.
Then I try to make an example:
package main
import "github.com/gin-gonic/gin"
func main() {
r := gin.Default()
r.GET("/ping", func(c *gin.Context) {
c.JSON(200, gin.H{
"message": "pong",
})
})
r.Run() // listen and serve on 0.0.0.0:8080 (for windows "localhost:8080")
}
However, go run example.go made the error:
example.go:3:8: cannot find package "github.com/gin-gonic/gin" in any of:
/usr/local/go/src/github.com/gin-gonic/gin (from $GOROOT)
/home/zyh/go/src/github.com/gin-gonic/gin (from $GOPATH)
In my system, $GOROOT is /usr/local/go/ and $GOPATH is ~/go/.
How could I solve this problem?
For Go version 1.11 or newer, You should use Go Modules.
If you are just starting with Go, you should start with the newer version. I think you are using a Go version that supports go modules already because the modules you are trying to get are downloading to ~/go/pkg/mod/ directory.
To initialize a project with go module, run:
go mod init your-project-name
This will create a go.mod file in your project directory.
Add missing and/or remove unused modules:
go mod tidy
This will fill up the go.mod file with appropriate modules and create a go.sum in your project directory. The go.sum contains expected cryptographic hashes of each module version.
After that, the go run example.go command should run the program without any issues.
You can even vendor the modules in your project directory:
go mod vendor
This will bring all the vendors to your projects /vendor directory so that you don't need to get the modules again if working from another machine on this project.
I realized that after adding a package called gopls, my IDE is working perfectly.
Install gopls using snap: sudo snap install gopls --classic
From the error, you can see that GOPATH is your '/home/zyh/go' not your ~/go.
and you can run shell go env to confirm where is your GOPATH? then modify it.

Installing MongoDb with Puppet

I'm a newbie in Puppet, so maybe you'll find my question a bit stupid...
So, I'm looking for puppet recipe that will install and run Mongodb 2.2 on my machine. By googling I found this module http://forge.puppetlabs.com/puppetlabs/mongodb But I didn't understand clear what should I do?
It said I have to install module on puppet node first. What does exactly it means?
Let's say, I have a set of machines those must be configured via puppet.
What do I have to add to puppet recipe to reach this aim?
In case someone might be interest on installing the last version of MongoDB this worked very well for me. At the moment of writing the latest stable version is MongoDB 3.0.3.
First of all update your OS repositories via the puppet apt module (in case you're using a Debian or Ubuntu distribution). Change the data below according to your distribution and version. Check here to get the MongoDB official repositories information: http://docs.mongodb.org/manual/administration/install-on-linux/#recommended
# $::lsbdistcodename should contain what you usually get
# with the `lsb_release -sc` command
$server_lsbdistcodename = downcase($::lsbdistcodename)
apt::source { 'mongodb-org-3.0':
location => 'http://repo.mongodb.org/apt/debian',
release => "${server_lsbdistcodename}/mongodb-org/3.0",
repos => 'main',
key => '7F0CEB10',
key_server => 'keyserver.ubuntu.com',
include_src => false
}
And then set the mongodb::globals class properly to make sure you get MongoDB 3. The MongoDB puppet module I'm using is this one.
class { 'mongodb::globals':
manage_package_repo => false, # disable the 10gen repository
server_package_name => 'mongodb-org',
service_name => 'mongod',
version => '3.0.3',
}->
class { '::mongodb::server': }
Getting mongodb installed with puppet isn't as easy as it seems. It's somewhat difficult to get official Puppet Labs module v0.8.0 to install mongodb 2.6.3. You end up getting an apt error about mongodb-10gen=2.6.3 not being found. There's an issue and a patch already but it hasn't been published yet.
So here's what you need to do:
git clone https://github.com/puppetlabs/puppetlabs-mongodb.git
Then use the following puppet config:
class { '::mongodb::globals':
manage_package_repo => true,
server_package_name => 'mongodb-org',
version => '2.6.3'
}->
class { '::mongodb::server': }
This Worked for me.
If you are running puppet standalone, you will have already installed the puppet gem and have the puppet executable. To intall the module, you run puppet module install puppetlabs/mongodb. After the module installation, you can simply include the mongodb module in your node definition
node 'myhost' {
include mongodb
}
If you want to run a number of nodes that need access to the module, you'll have to setup a puppetmaster and install the node. See [Basic Agent/Master setup][1] for more info. Make sure that pluginsync=true is enabled in puppet.conf so the module can make it's way to the remote agents.
The puppetmaster will then need a file, normally site.pp defined with the nodes it should configure. Finally, include the mongodb module on each node you want to run mongodb and you should be up and running.

Resources