Minecraft AdvancedBan Layout plugin not working - plugins

EDIT/UPDATE: Figured out the problem!
So I am trying to configure a script for banning players (AdvancedBan plugin), and the tab completion keeps failing. I put it into YAMLlint and I still don't know whats wrong. Looks fine too me, and I hardly know anything about coding (I just know how to type and copy stuff pretty much). Please help me out and tell me what is wrong with the file, thanks.
ALSO please note that with YAML, line 83 and line 69 are problematic, but I have no idea what it means (its saying "(): did not find expected alphabetic or numeric character while scanning an anchor at line 83 column 8" for line 83 and for line 69 it says: "(): did not find expected '-' indicator while parsing a block collection at line 69 column 5"
Thanks to anyone who can help
The file:
Message:
UnbanNotice:
- '&4&lNOTICE'
- ''
- '&8The admins have determined that your behavior on this server'
- '&8has been in violation of our rules.'
- '&eYour account was banned temporarily within the past 30 days.'
- 'Your ban has expired and you are currently unsuspended.'
- ''
- '&8Reason:&c %REASON%'
- ''
- '&8Please abide by the rules so that this server'
- '&8can be fun for everyone who plays.'
Warning:
- '&4&lWARNING'
- ''
- '&8The admins have determined that your behavior on this server'
- '&8has been in violation of our rules.'
- ''
- '&8Date: %DATE%'
- ''
- '&8Reason: %REASON%'
- ''
- '&8Please abide by the rules so that this server'
- '&8can be fun for everyone who plays.'
30DayBan:
- '&4&lBANNED FOR 30 DAYS'
- ''
- '&8The admins have determined that your behavior on this server'
- '&8has been in violation of our rules.'
- ''
- '&8Date: %DATE%'
- ''
- '&8Reason:&c %REASON%'
- ''
- '&8Please abide by the rules so that this server'
- '&8can be fun for everyone who plays.'
- '&8Your account has been suspended from play on this server.'
- '&8You will be unsuspended in:&c %DURATION%'
1DayBan:
- '&4&lBANNED FOR 1 DAY'
- ''
- '&8The admins have determined that your behavior on this server'
- '&8has been in violation of our rules.'
- ''
- '&8Date: %DATE%'
- ''
- '&8Reason:&c %REASON%'
- ''
- '&8Please abide by the rules so that this server'
- '&8can be fun for everyone who plays.'
- '&8Your account has been suspended from play on this server.'
- '&8You will be unsuspended in:&c %DURATION%'
3DayBan:
- '&4&lBANNED FOR 3 DAYS'
- ''
- '&8The admins have determined that your behavior on this server'
- '&8has been in violation of our rules.'
- ''
- '&8Date: %DATE%'
- ''
- '&8Reason:&c %REASON%'
- ''
- '&8Please abide by the rules so that this server'
- '&8can be fun for everyone who plays.'
- '&8Your account has been suspended from play on this server.'
- '&8You will be unsuspended in:&c %DURATION%'
7DayBan:
- '&4&lBANNED FOR 7 DAYS'
- ''
- '&8The admins have determined that your behavior on this server'
- '&8has been in violation of our rules.'
- ''
- '&8Date: %DATE%'
- ''
- '&8Reason:&c %REASON%'
- ''
- '&8Please abide by the rules so that this server'
- '&8can be fun for everyone who plays.'
- '&8Your account has been suspended from play on this server.'
- '&8You will be unsuspended in:&c %DURATION%''
14DayBan:
- '&4&lBANNED FOR 14 DAYS'
- ''
- '&8The admins have determined that your behavior on this server'
- '&8has been in violation of our rules.'
- ''
- '&8Date: %DATE%'
- ''
- '&8Reason:&c %REASON%'
- ''
- '&8Please abide by the rules so that this server'
- '&8can be fun for everyone who plays.'
- '&8Your account has been suspended from play on this server.'
- '&8You will be unsuspended in:&c %DURATION%'
AccountRemoval:
- '&4&lACCOUNT REMOVED'
- ''
- '&8The admins have determined that your behavior on this server'
- '&8has been in violation of our rules.'
- ''
- '&8Date: %DATE%'
- ''
- '&8Reason:&c %REASON%'
- ''
- '&8Please abide by the rules so that this server'
- '&8can be fun for everyone who plays.'
- '&8Your account has been removed from this server.'
IpBan:
- '&fConnection failed! You do not have access to connect!'
PoisonBan:
- '&4&lACCOUNT REMOVED'
- ''
- '&8The admins have determined that your behavior on this server'
- '&8has been in violation of our rules.'
- ''
- '&8Date: %DATE%'
- ''
- '&8Reason:&c %REASON%'
- ''
- '&8Please abide by the rules so that this server'
- '&8can be fun for everyone who plays.'
- '&8Your account has been removed from this server, and new account entry has been disabled'
InvalidCredentialsBan:
- '&4Access Denied: Invaild Credentials'
Time:
1DayBan:
- '1d'
3DayBan:
- '3d'
7DayBan:
- '1w'
14DayBan:
- '2w'
30DayBan:
- '1mo'
IpBan:
- '1w'

Related

vars_files: doesn't work. Not able to parse/read variables

hosts:
vars_files:
- utv_vars.yml
Get this in run:
[WARNING]: Skipping key (vars_files) in group (hosts) as it is not a mapping, it is a <class 'ansible.parsing.yaml.objects.AnsibleSequence'>
Solved!
added dir /group_vars/utv_vars.yml

how to insert tab in sed command?

I have a text file in which there's a YAML formatted code. Here's the code:
trigger:
branches:
include:
- develop
- release/*
- rapid/*
- Sprint/*
- Unity/*
Now, I have a bash script through which I want to add a string after this string; " - develop". Here's the point I want to maintain the spacing format.
Here;s my bash file code.
$target_string= " - develop"
$replacment_string=" - TerraformTest/*"
sed -i "/$target_string/a$replacment_string" test.txt
But the result I got it this:
trigger:
branches:
include:
- develop
- TerraformTest/*
- release/*
- rapid/*
- Sprint/*
- Unity/*
Is there any way, I can put tab in sed command to obtain the output like this:
trigger:
branches:
include:
- develop
- TerraformTest/*
- release/*
- rapid/*
- Sprint/*
- Unity/*
You could use a YAML-aware tool such as yq. This command inserts TerraformTest/* as the second element in the array at .trigger.branches.include:
yq '
.trigger.branches.include |=
([.[0], "TerraformTest/*", del(.[0])] | flatten)
' infile.yml
You can match match and grab space of search string in a capture group and use it in replacement:
sed -E 's~^([[:blank:]]*)- develop~&\n\1- TerraformTest/*~' file
trigger:
branches:
include:
- develop
- TerraformTest/*
- release/*
- rapid/*
- Sprint/*
- Unity/*
Or using variables:
target_string='- develop'
replacment_string='- TerraformTest/*'
sed -E "s~^([[:blank:]]*)$target_string~&\n\1$replacment_string~" file
trigger:
branches:
include:
- develop
- TerraformTest/*
- release/*
- rapid/*
- Sprint/*
- Unity/*
Breakup:
^: Start
([[:blank:]]*): Match 0 or more whitespaces in capture group #1
$target_string: Match string contained in $target_string
Replacement:
&: Place whole match back
\n: Place a line break
\1: Place spaces string on next line
$replacment_string: Place new replacement value
TO save changes inline use:
sed -i.bak -E "s~^([[:blank:]]*)$target_string~&\n\1$replacment_string~" file
With your shown samples only, please try following awk code. Written and tested in GNU awk.
awk -v RS= '
match($0,/^trigger:\n[[:space:]]+branches:\n[[:space:]]+include:\n[[:space:]]+- develop/){
print substr($0,RSTART,RLENGTH)"\n - TerraformTest/*" substr($0,RSTART+RLENGTH)
}
' Input_file
It is best practice to use a YAML aware tool such as yq, Perl, Python, etc.
Here is a Ruby:
ruby -r yaml -e 'y=YAML.load($<.read)
begin
a=y["trigger"]["branches"]["include"]
a.insert(a.find_index("develop")+1,"TerraformTest/*")
puts YAML.dump(y)
rescue
puts "Not Found"
end
' file
Prints:
---
trigger:
branches:
include:
- develop
- TerraformTest/*
- release/*
- rapid/*
- Sprint/*
- Unity/*
Using sed
$ sed -Ei.bak '/ +- develop/{p;s/[a-z]+/TerraformTest\/*/}' file
trigger:
branches:
include:
- develop
- TerraformTest/*
- release/*
- rapid/*
- Sprint/*
- Unity/*

Compiling with multiple scala versions

I wanted to run travis build against two Scala versions (2.12, 2.13) i.e crossCompilation, so I created two jobs for it, as logs were huge and there is a log limit of 4 MB in travis. So I created two jobs for it.Here is my travis.yml file. I am not so good with travis-ci. So I am struggling to run two jobs with different scala versions. Here is my travis.yml file:
language: scala
jdk:
- openjdk11
if: tag IS blank
services:
- mysql
addons:
apt:
sources:
- mysql-5.7-xenial
packages:
- mysql-server
dist: bionic
sudo: required
before_install:
- echo -e "machine github.com\n login $GITHUB_AUTH_TOKEN" > ~/.netrc
- mysql -e 'CREATE DATABASE IF NOT EXISTS $ZZ_API_TEST_DB_NAME;'
- sudo mysql -e "use mysql; update user set authentication_string=PASSWORD('') where user='$ZZ_API_DB_USERNAME'; update user set plugin='mysql_native_password';FLUSH PRIVILEGES;"
- sudo mysql_upgrade -u $ZZ_API_DB_USERNAME
- sudo service mysql restart
git:
depth: false
env:
global:
- ZZ_API_DB_HOST="localhost:3306"
- ZZ_API_TEST_DB_NAME=issue_management_test
- ZZ_API_DB_USERNAME=root
- ZZ_API_DB_PASSWORD=""
- SCALA_2_12="2.12.8"
- SCALA_2_13="2.13.3"
before_cache:
- find $HOME/.ivy2 -name "ivydata-*.properties" -delete
- find $HOME/.sbt -name "*.lock" -delete
cache:
directories:
- $HOME/.sbt/boot/scala*
- $HOME/.sbt/cache
- $HOME/.sbt/launchers
- $HOME/.ivy2/cache
- $HOME/.coursier
stages
- version_2.12
- version_2.13
jobs:
include:
- stage: version_2.12
name: "2.12.8"
script:
- if [ "$TRAVIS_EVENT_TYPE" == "cron" ]; then sbt coverage $SCALA_2_12 test ; else sbt $SCALA_2_12 test; fi
after_success:
- sbt coverageReport coverageAggregate
deploy:
- provider: script
skip_cleanup: true
script: sbt publish
on:
all_branches: true
condition: $TRAVIS_BRANCH != master || $TRAVIS_BRANCH != develop
- provider: script
skip_cleanup: true
before_deploy:
- travis/before_deploy.sh
script: sbt publish
on:
branch: develop
- provider: script
skip_cleanup: true
script: travis/release.sh
on:
branch: master
- stage: version_2.13
name: "2.13.3"
script:
- if [ "$TRAVIS_EVENT_TYPE" == "cron" ]; then sbt coverage $SCALA_2_13 test ; else sbt $SCALA_2_13 test; fi
after_success:
- sbt coverageReport coverageAggregate
deploy:
- provider: script
skip_cleanup: true
script: sbt publish
on:
all_branches: true
condition: $TRAVIS_BRANCH != master || $TRAVIS_BRANCH != develop
- provider: script
skip_cleanup: true
before_deploy:
- travis/before_deploy.sh
script: sbt publish
on:
branch: develop
- provider: script
skip_cleanup: true
script: travis/release.sh
on:
branch: master
I am not much familiar with travis, somehow its not picking
- SCALA_2_12="2.12.8"
- SCALA_2_13="2.13.3"
and this command:
- if [ "$TRAVIS_EVENT_TYPE" == "cron" ]; then sbt coverage $SCALA_2_12 test ; else sbt $SCALA_2_12 test; fi
is failing in travis build.
How to specify two different scala versions for these two different task, someone please help on this
It worked finally, this change I did,
changed $SCALA_2_13 to ++$SCALA_2_13

Make DEPLOY job automatic for release branches and manual for others with GitLab CI

The next solution should work.
deploy_release:
stage: deploy
tags:
- linux
only:
- master
- stable
retry: 2
script:
- do_action 1
- do_action 2
- git push artifacts
deploy_manual:
stage: deploy
tags:
- linux
except:
- master
- stable
when: manual
retry: 2
script:
- do_action 1
- do_action 2
- git push artifacts
But it has one ☝️ significant lack – script: is repeated 2 times.
I think it would be a good idea to write something like:
.deploy_base:
stage: deploy
tags:
- linux
retry: 2
script:
- do_action 1
- do_action 2
- git push artifacts
deploy_release:
include: .deploy_base
only:
- master
- stable
deploy_manual:
include: .deploy_base
except:
- master
- stable
when: manual
But I doubt this will work. Is it possible to do something similar in YAML?
The other straight-forward idea is to
move script: to separate file deploy_script.sh
and finish the problem in the bud.
Here it is
https://docs.gitlab.com/ce/ci/yaml/README.html#extends
extends
Introduced in GitLab 11.3
extends defines an entry name that a job, that uses extends is going to inherit from.
extends in an alternative to using YAML anchors that is a little more flexible and readable.
.tests:
only:
refs:
- branches
rspec:
extends: .tests
script: rake rspec
stage: test
only:
variables:
- $RSPEC
Thanks to this Q&A yaml repeated node that is a key
The solution is:
.deploy_base: &deploy_base
stage: deploy
tags:
- linux
retry: 2
script: &deploy_script
- do_action 1
- do_action 2
- git push artifacts
deploy_release:
only: &deploy_release_only
- master
- stable
script: *deploy_script
deploy_manual:
except: *deploy_release_only
when: manual
script: *deploy_script
And even better:
inherit .deploy_base:
.deploy_base: &deploy_base
stage: deploy
tags:
- DlpcsCore
- linux
retry: 2
variables:
URL: 'git#gitlab.com:Yahoo/HeavenShine-bin.git'
script: &deploy_script
- do_act_1
- do_action_2
deploy_release:
<< : *deploy_base
only: &deploy_release_only
- master
- stable
- CI
#- /^master[-_].+$/
#- /^(.+)[+]bin$/
deploy_manual:
<< : *deploy_base
except: *deploy_release_only
when: manual
To get know more search for YAML merge
Gitlab now support this via rules directive: https://docs.gitlab.com/ee/ci/yaml/#rules-clauses

Ansible: add items to single string conditionally

Currently working on ansible playbook for postgresql installation.
Trying to insert multiple values to shared_preload_libraries. Idea is to be able to insert them conditionnaly and different roles must be able to append to this line without overwriting it.
Current solution:
- name: Check whether postgresql.conf contains "pg_stat_statements"
command: grep "pg_stat_statements" "{{ pg_data }}/postgresql.conf"
register: check_shared_libs
check_mode: no
ignore_errors: yes
changed_when: no
- name: Modify postgresql.conf add pg_stat_statements shared library.
replace:
backup: yes
dest: "{{ pg_data }}/postgresql.conf"
regexp: "^#?(shared_preload_libraries = '.*)(')"
replace: '\1,pg_stat_statements\2'
when: check_shared_libs.rc != 0
notify: restart postgres
which gives me something like this: shared_preload_libraries = ',pg_stat_statements,powa,pg_stat_kcache,pg_qualstats,pg_wait_sampling'
Works fine, but I wonder if there's any better way to do it.
one way to avoid using the command task is the below. it comprises of 2 tasks because reading a remote file into a variable cant be done with a lookup plugin..
so, step1 we read the whole file into a variable and step2 we check if the variable contains the pg_stat_statements:
code:
---
- name: test play
hosts: localhost
connection: local
gather_facts: false
become: yes
vars:
pg_stat_statements_exists: false
tasks:
- name: read file
slurp:
src: /tmp/postgresql.conf
register: postgresql_file
- name: check pg_stat_statements exists
set_fact:
pg_stat_statements_exists: true
when: postgresql_file['content'] | b64decode is search('pg_stat_statements') == true
- name: print variable that will control the replace task that follows
debug:
var: pg_stat_statements_exists
and adding your replace task with the modified when condition:
- name: Modify postgresql.conf add pg_stat_statements shared library.
replace:
backup: yes
dest: "{{ pg_data }}/postgresql.conf"
regexp: "^#?(shared_preload_libraries = '.*)(')"
replace: '\1,pg_stat_statements\2'
when: pg_stat_statements_exists == true
notify: restart postgres
hope it helps