wikiprep MediaWiki::DumpFile namespace - perl

I am trying to use wikiprep with support of MediaWiki::DumpFile to parse wikipedia dump.
The problem is it doesn't work.
wikiprep -format composite -compress -f enwiki.xml.0001.gz
Can't locate object method "namespaces" via package "MediaWiki::DumpFile::Pages" at /usr/local/share/perl5/MediaWiki/DumpFile/Compat.pm line 148.
But I do have namespaces.
...
<siteinfo>
<sitename>Wikipedia</sitename>
<dbname>enwiki</dbname>
<base>http://en.wikipedia.org/wiki/Main_Page</base>
<generator>MediaWiki 1.25wmf23</generator>
<case>first-letter</case>
<namespaces>
<namespace key="-2" case="first-letter">Media</namespace>
...
I don't understand how to run this parser.

Related

Error when try apply configmap to auth with EKS cluster

i have the follow question. i try connect to eks cluster using a Terraform with Gitlab CI/CD , i receive the error message , but when try it in my compute , this error dont appear, someone had same error ?
$ terraform output authconfig > authconfig.yaml
$ cat authconfig.yaml
<<EOT
apiVersion: v1
kind: ConfigMap
metadata:
name: aws-auth
namespace: kube-system
data:
mapRoles: |
- rolearn: "arn:aws:iam::503655390180:role/clusters-production-workers"
username: system:node:{{EC2PrivateDNSName}}
groups:
- system:bootstrappers
- system:nodes
EOT
$ kubectl create -f authconfig.yaml -n kube-system
error: error parsing authconfig.yaml: error converting YAML to JSON: yaml: line 2: mapping values are not allowed in this context
The output is including EOT(EndOfText) marks since it is generated as a multiline string originally.
as documentation suggests (terrafom doc link)
Don't use "heredoc" strings to generate JSON or YAML. Instead, use the
jsonencode function or the yamlencode function so that Terraform can
be responsible for guaranteeing valid JSON or YAML syntax.
use json encoding or yaml encoding before building output.
If you want to continue like this with what you have now then try to give these options with output -json or -raw
terraform output -json authconfig > authconfig.yaml
or
terraform output -raw authconfig > authconfig.yaml
The error message tells you the authconfig.yaml file can not be converted from YAML to JSON, suggesting it's not a valid yaml
The cat authconfig.yaml you're showing us includes some <<EOT and EOT tags. I would suggest to remove those, before running kubectl create -f
Your comment suggests you knew this already - then why didn't you ask about terraform, rather than showing us kubectl create failing? From your post, it really sounded like you copy/pasted the output of your job, without even reading it.
So, obviously, the next step is to terraform output -raw, or -json, there are several mentions in their docs, or knowledge base, a google search would point you to:
https://discuss.hashicorp.com/t/terraform-outputs-with-heredoc-syntax-leaves-eot-in-file/18584/7
https://www.terraform.io/docs/cli/commands/output.html
Last: we could ask why? Why would you terraform output > something, when you can have terraform write a file?
While as a general rule, whenever writing terraform stdout/stderr to files, I strongly suggest going with no-color.

How to use OPC UA-ModelCompiler with multiple xml model input files?

I've used succesfully UA-ModelCompiler from OPCFoundation (https://github.com/OPCFoundation/UA-ModelCompiler) for compiling my xml model, using the following format:
OPC.UA.ModelCompiler.exe -d2 ".\MyOpcUaBasic.xml" -cg ".\MyOpcUaBasic.csv" -o2 ".\MyOutputFolder"
I'd like to compile another OPC UA xml model that uses more than one namespace declared at the beginning of the model.
Example:
<Namespaces>
<Namespace Name="MyOpcUaBasic" Prefix="Opc.Ua.Basic" XmlPrefix="MyOpcUaBasic">http://Myorganization.it/Basic/"</Namespace>
<Namespace Name="MyOpcUaBasic2" Prefix="Opc.Ua.Basic2" XmlPrefix="MyOpcUaBasic2">http://Myorganization.it/Basic2/"</Namespace>
<Namespace Name="OpcUa" Prefix="Opc.Ua" XmlPrefix="OpcUa" XmlNamespace="http://opcfoundation.org/UA/2008/02/Types.xsd">http://opcfoundation.org/UA/</Namespace>
</Namespaces>
So I need more than one xml input to generate my xml nodeset.
I have tried the following:
OPC.UA.ModelCompiler.exe -d2 ".\MyOpcUaBasic.xml" -cg ".\MyOpcUaBasic.csv" -d2 ".\MyOpcUaBasic2.xml" -cg ".\MyOpcUaBasic2.csv" -o2 ".\MyOutputFolder"
But it does not work giving an error.
How should I do?
It is possible the usage is not right, but I have't found how to use more than one input xml to create my nodeset, if this is possible.
Thanks.
Found the solution, I forgot the FilePath field
<Namespace Name="MyOpcUaBasic" Version="1.00" PublicationDate="2020-05-27T00:00:00Z" Prefix="Opc.Ua.SmBasic" XmlPrefix="MyOpcUaBasic" XmlNamespace="http://Myorganization.it/OpcUa/ServicesModel/Basic/Types.xsd" FilePath="MyOpcUaBasic">http://Myorganization.it/Basic/</Namespace>

helmignore double-star syntax is not supported in helm 3

I want to ignore specifics files in subchart folder (because some objects, like secrets, are created by all my subchart, so duplicated...). I don't know the depth of these objects. So I want to use this syntax in .helmignore :
charts/**/myfile.yaml
But I got this error :
Error: double-star (**) syntax is not supported
How can I do that in helm 3 ?
Unfortunately, this feature doesn't supported nether in helm2 nor helm3.
helm2 source code: link
helm3 source code: link
Try to ignore it explicitly:
$ cat .helmignore
secrets
# or
./secrets/my-secret.yaml

OpenShift template "object already exists" error

I have developed an Openshift template which basically creates two objects (A cluster & a container operator).
I understand that templates run oc create under the hood. So, in case any of these two objects already exists then trying to create the objects through template would through an error. Is there any way to override this behaviour? I want my template to re-configure the object even if it exists.
You can use "oc process" which renders template into set of manifests:
oc process foo PARAM1=VALUE1 PARAM2=VALUE2 | oc apply -f -
or
oc process -f template.json PARAM1=VALUE1 PARAM2=VALUE2 | oc apply -f -

How do i run PMD on a command line in linux

I tried
$java -jar ../lib/pmd-5.0.0.jar /var/lib/jenkins/jobs/MYPROJECT/workspace/ xml
error:
Failed to load Main-Class manifest attribute from
../lib/pmd-5.0.0.jar
as per docs from PMD
i also tried:
$java -jar ../lib/pmd-5.0.0.jar /var/lib/jenkins/jobs/MYPROJECT/workspace/ xml java-basic,java-design -encoding UTF-8
Failed to load Main-Class manifest attribute from
../lib/pmd-5.0.0.jar
resolved it by using the following Syntax:
cd ../pmd/bin
./run.sh pmd /var/lib/jenkins/workspace/MYPROJECT/ xml java-basic,java-design -encoding UTF-8 | tee ../../MYPROJECT/pmd.xml
Where do you see that in the doc you linked to?
All of the examples I see on that page say to run java using the PMD class name rather than with the -jar flag. (Which is what I use when running PMD)
Which gives you something like:
java net.sourceforge.pmd.PMD /var/lib/jenkins/jobs/MYPROJECT/workspace/ xml rulesets/java/imports.xml