puppet migration: v3.8.5 -> v5.4.0 "Could not find template" - puppet

I'm migrating a from puppetmaster on Xenial (v3.8.5) to Bionic (v5.4.0) and have run into an issue. So far I've copied the node and modules files from the old server to the new and had a client connect. I keep getting the following error on the client and master:
Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Function Call, Could not find template 'ntp/client_ntp.conf.erb' (file: /etc/puppet/code/environments/production/manifests/modules/ntp/manifests/init.pp, line: 17, column: 20) on node owain18.dimerocker.com
The template file exists at: /etc/puppet/code/environments/production/manifests/modules/ntp/templates/client_ntp.conf.erb
The contents of ntp/manifests/init.pp:
class ntp {
package { "ntp": }
file { "/etc/ntp.conf":
mode => "644",
content => template("ntp/client_ntp.conf.erb"),
notify => Service["ntp"],
require => Package["ntp"],
} # file
service { "ntp":
ensure => running,
enable => true,
require => Package["ntp"],
} # service
} # class ntp
(I removed some comments from the top of the file so the line number in the error doesn't match, but there's no code missing.)
Any pointers on how to fix this issue? Thanks for your help.

Related

Node.JS rename file in mounted drive

I want to be able to rename files using Node.JS and then rename them back via a separate system and then rename them again via Node.JS.
When renaming a file using Node.JS fs.rename it works the first time, but when trying renaming it back to the original name and then running Node.JS fs.rename to rename it again it does not work, there's no error or anything. i.e.
await fs.promises.rename('/var/lib/sitecontents/old.csv', '/var/lib/sitecontents/new.csv') # Works
# Rename back to old.csv using Window file browser connected to the share
await fs.promises.rename('/var/lib/sitecontents/old.csv', '/var/lib/sitecontents/new.csv') # Doesn't work, no error
I tried using the fs-extras library and the move function and it returned this error: "Error: Source and destination must not be the same.", even thought the files had different names.
I have also tried to copy and delete
const rename = async (path) => {
const newPath = `${path}_processed`;
try {
await fs.promises.copyFile(path, newPath, async (err) => {
if (err) throw err;
await fs.promises.unlink(path, (ierr) => {
if (ierr) throw ierr;
console.log(`-----removed: ${path}`);
});
console.log(`-----moved: ${path}, ${newPath}`);
});
} catch (t) {
console.log(t);
}
}
Which gives me this message:
UnhandledPromiseRejectionWarning: Error: Unknown system error -116
I have also tried child_process.exec with no luck
exec(`mv ${path} ${newPath}`);
Error I am getting from that is
{
killed: false,
code: 1,
signal: null,
cmd: 'mv /var/lib/sitedata/azure_devops_integration/dev/twoo.csv /var/lib/sitedata/azure_devops_integration/dev/twoo.csv.error',
stdout: '',
stderr: 'mv: ‘/var/lib/sitedata/azure_devops_integration/dev/twoo.csv’ and ‘/var/lib/sitedata/azure_devops_integration/dev/twoo.csv.error’ are the same file\n'
}
I'm using Node.JS 12.19.0 on RHEL. The folder that the files are in is mounted via a shared drive, and there is only issues when renaming the files back to the original name via windows share. If I rename the files using RHEL and the mv command there is no issue.

Problem connecting to Azure Service Bus using rabbitmq-amqp1.0-client

I'm trying to connect Azure Service Bus (AMQP 1.0) using this erlang client: https://github.com/rabbitmq/rabbitmq-amqp1.0-client
The elixir wrapper library https://github.com/pma/amqp doesn't seem like using AMQP 1.0. So I'm trying to use the erlang client directly.
I did the following:
git clone https://github.com/rabbitmq/rabbitmq-amqp1.0-client.git
cd rabbitmq-amqp1.0-client
make
make shell
Then I created a config as per the README file at https://github.com/rabbitmq/rabbitmq-amqp1.0-client
OpnConf = #{address => Hostname,
port => Port,
hostname => <<"abc-shankardevy.servicebus.windows.net">>,
tls_opts => {secure_port, [{versions, ['tlsv1.1']}]},
container_id => <<"test-container">>,
transfer_limit_margin => 100,
sasl => {plain, User, Password}}.
When I try to open the connection as in the README, I get the following error. I'm not able to follow the erlang error message. Any help is appreciated.
{ok, Connection} = amqp10_client:open_connection(OpnConf).
** exception exit: {noproc,{gen_server,call,
[amqp10_client_sup,
{start_child,[#{address =>
'abc-shankardevy.servicebus.windows.net',
container_id => <<"test-container">>,
hostname => <<"abc-shankardevy.servicebus.windows.net">>,
notify => <0.111.0>,port => 5671,
sasl =>
{plain,'RootManageSharedAccessKey',
'mykey'},
tls_opts => {secure_port,[{versions,['tlsv1.1']}]},
transfer_limit_margin => 100}]},
infinity]}}
in function gen_server:call/3 (gen_server.erl, line 223)
in call from amqp10_client_connection:open/1 (src/amqp10_client_connection.erl, line 110)
Try "starting" the application first:
application:ensure_all_started(amqp10_client).
It's complaining about not finding a certain process (noproc), namely the one called amqp10_client_sup. This process is started when the application is started, by this piece of code:
-module(amqp10_client_app).
-behaviour(application).
-export([start/2,
stop/1]).
start(_Type, _Args) ->
amqp10_client_sup:start_link().

Puppet invalid parameter encoding

Trying to use puppets file_line to update /etc/environment
class system_variables {
include stdlib
file { '/etc/environment':
ensure => present
} ->
file_line { 'Add ENVIRONMENT_TYPE':
path => '/etc/environment',
line => 'ENVIRONMENT_TYPE="production"',
match => '^ENVIRONMENT_TYPE'
}
}
But keep getting error:
Error: /Stage[main]/System_variables/File_line[Add ENVIRONMENT_TYPE]: Could not evaluate: Invalid parameter encoding(:encoding)
I have tried googling but to no avail.
Edit:
Ive also tested it on the master server where it runs without errors.
The file encoding is the same on both servers, and checked locales on each server aswell.

Laravel 5.4 Broadcast : Pusher->Error->WebSocketError

I just began to use Broadcasting with Pusher and Echo. My problem is that I'm getting an error and I can't find how to resolve it. The error message look pretty straigthfoward, but I have no idea where I should head to get rid of it.
My laravel is an upgrade from Laravel 5.3. I uncommented the App/Providers/BroadcastServiceProvider::class into config.php.
I created an event and set the Private channel.return new PrivateChannel('dealer.'$this->client->dealer_id);
I added the new channel into routes/channels.php
Broadcast::channel('dealer.{dealerId}', function ($user, $dealerId) {
return (int) $user->dealer_id === (int) $dealerId;
});
I added this to bootstrap.js
window.Echo = new Echo({
broadcaster: 'pusher',
key: 'my-secrect-key'
});
I also added everything to the .env file. Finally, I added the channel to the script at the end of the applayout.blade.php
Echo.private(`dealer.1`)
.listen('NewClient', (e) => {
console.log(e);
});
When I load the page, this is the error I got from the console:
Pusher : Error : {
"type":"WebSocketError",
"error":{
"type":"PusherError",
"data":{
"code":null,
"message":"Auth value for subscription to private-dealer.1 is invalid: should be of format 'key:signature'"
}
}
}
What am I missing/doing wrong?
Upgrading Laravel 5.3 to 5.4 you should make changes in your .env file
Change From:
PUSHER_KEY
PUSHER_SECRET
to
PUSHER_APP_KEY
PUSHER_APP_SECRET
Someone answered it on Laracast. Link

Puppet notify service error

I try to write a puppet configuration in order to install lamp env.
But i have an issue with notify option.
I have an apache conf:
class apache inherits apache::params {
package { 'apache':
name => "${apache::params::package}",
ensure => present
}
service { 'apache':
ensure => running,
name => $apache::params::service,
enable => true,
subscribe => Package['apache'],
}
}
and and php module conf:
define php::module(
$notify = $php::params::notify,
$package_prefix = $php::params::module_package_prefix
) {
package { "php-module-${name}":
ensure => present,
name => "${package_prefix}${name}",
notify => Service['apache'],
require => [Class['apache'], Package['php', 'php-dev']]
}
}
but when I launch puppet I have this error:
Error: Parameter notify failed on Php::Module[mcrypt]: No title provided and "apache" is not a valid resource reference
I don't understand why it said that apache service is not a valid resources ?
I think there might be 2 issues here:
1) Puppet doesn't like this line in php::module:
$notify = $php::params::notify,
Can you try to remove that or check what is in $php::params::notify? (I don't see you using it)
2) Did you have something like
include apache
in your site.pp? The class still needs to be declared before you can reference the contained resources.

Resources