I am new to vagrant and chef. I spin up my Vm using Vagrant and provision it using Chef-solo. I add the cookbook for glassfish downloaded from opscode chef. Glassfish is installed, but not started. I have given in my vagrantfile
chef.add_recipe "glassfish::attribute_driven_domain"
chef.json = {
"glassfish" => {
"base_dir" => "/usr/local/glassfish",
"domains_dir" => "/usr/local/glassfish/glassfish/domains",
"domains" => {
"domain1" => {
"config" => {
"domain_name" => "domain1",
"admin_port" => 4848,
"username" => "root",
"password" => "admin",
"remote_access" => true
}
}
}
}
}
You only called the glassfish::attribute_driven_domain recipe. To create the domain you also have to call the glassfish::default recipe.
The glassfish::default recipe creates the domain.xlm template used as base for the Glassfish domain.
Related
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 need a way to get all my ember tests' nameS, since I want to run them in a separate thread by using the --filter "TEST-NAME" flag.
Right now, I am using a hardcoded array.
It's not documented, but you can use the config object on the root QUnit object to get all modules in your test suite, then the tests within each module and their names. Note that any tests not in a module will still appear, but with an empty-named module. Here's a runnable jsfiddle with the example, then the code below.
QUnit.test('no-module', (assert) => { assert.equal(0,0) })
QUnit.module('foobar', () => {
QUnit.test('foo', (assert) => { assert.equal(1, 1) })
QUnit.test('bar', (assert) => { assert.equal(2, 2) })
})
QUnit.module('batbaz', () => {
QUnit.test('bat', (assert) => { assert.equal(3, 3) })
QUnit.test('baz', (assert) => { assert.equal(4, 4) })
})
const testNames = []
QUnit.config.modules.forEach((module) => {
testNames.push(...module.tests.map(test => test.name))
})
console.log(testNames)
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
I am using Cakephp 3 for building new application where user have to login for their account however I am hitting the login URL http://localserver.com/members/login and it redirects me to http://localserver.com/users/login
Look like the 'users' controller is set by default in Auth component. How can I override the default controller from 'users' to 'members'?
NOTE: The URLs are not LIVE as I am working on my local-server.
Yes, this is related to the userModel config key, which defaults to Users.
Try this script in your controller’s beforeFilter() or initialize() methods.
// Pass settings in
$this->Auth->config('authenticate', [
'Basic' => ['userModel' => 'Members'],
'Form' => ['userModel' => 'Members']
]);
Update:
In addition to userModel to be worked properly you must set the loginAction too.
// Pass settings in
$this->Auth->config('authenticate', [
'loginAction' => [
'controller' => 'Members',
'action' => 'login',
'plugin' => false, // or 'Members' if plugin
],
'Basic' => ['userModel' => 'Members'],
'Form' => ['userModel' => 'Members']
]);
Cookbook 3.x Doc
I've been messing around with puppet and i ran into an issue that has stumped me.
maybe some one can shed some light. The idea is I have an rsync script that updates my authorized_keys
file on my puppet master. Every 4 hours puppet agent grabs the new authorized_keys file.
here is a Master manifest
class policy1::sshkey {
file { '/root/.ssh/':
ensure => directory,
path => '/root/.ssh/',
owner => 'root',
group => 'root',
mode => '0700',
}
file { '/root/.ssh/authorized_keys':
require => File ["/root/.ssh/authorized_keys"],
ensure => file,
owner => 'root',
group => 'root',
mode => '0600',
source => "puppet:///modules/policy1/authorized_keys",
}
}
my agent though gets this error
Error: Failed to apply catalog: Not a directory - /root/.ssh/authorized_keys
In your manifest, specifically the second resource definition you have it requiring itself. That said, you wanna do something like below:
class policy1::sshkey {
file { '/root/.ssh/':
ensure => directory,
path => '/root/.ssh/',
owner => 'root',
group => 'root',
mode => '0700',
}
file { '/root/.ssh/authorized_keys':
# Require the parent directory to be created beforehand.
require => File['/root/.ssh/'],
ensure => file,
owner => 'root',
group => 'root',
mode => '0600',
source => "puppet:///modules/policy1/authorized_keys",
}
}
... or I personally prefer:
class policy1::sshkey {
file { '/root/.ssh':
ensure => directory,
path => '/root/.ssh',
owner => 'root',
group => 'root',
mode => '0700',
}->
file { '/root/.ssh/authorized_keys':
ensure => file,
owner => 'root',
group => 'root',
mode => '0600',
source => 'puppet:///modules/policy1/authorized_keys',
}
}
It looks like disabling the
ensure => file,
seems to do the trick. Thanks Evgeny and Felix for your help.