How to get old value in OpenDJ server? - ldap

I've already enabled changelog on a standalone OpenDJ server and have "cn=changelog" appeared as one of nodes. And my problem is, that after fetching data from "cn=changelog", attribute "changes" contains only new value of changed attribute, without the old one. E.g. when attribute "cn" changed from "Peter" to "Paul", in "changes" there is only "Paul". Is it possible to get also old value of attribute? If yes, could you tell me where should I search for it or how should I configure OpenDJ to obtain it?

cn=changelog returns the performed operations:
an add operation contains the whole entry being added,
a delete operation contains only the dn of the deleted entry,
a modify dn contains the old dn and new rdn,
a modify operation may contain either the new value only (in case of REPLACE modification type), the removed value (in case of DELETE modification type), the new value (in case of ADD modification type), or no value at all (in case of INCREMENT modification type). Note that the various modification types can be combined in the same modify operation, so you may see a DELETE + ADD, containing the old value, but this is not mandatory.

Ok, after digging in documentation (Procedure 8.15), I found out that there is possibility to set 'ecl-include' option, which causes that changelog entry contains new attribute - 'includedAttributes'. This attribute includes old values (before entry's modification) for those attributes which we defined in 'ecl-include' option. But the disadvantage is, that 'includedAttributes' contains all defined attributes - regardless if those attributes has changed or not during entry's modification. So, for my question, it should be configured like this:
dsconfig set-external-changelog-domain-prop -h host -p port -D cn="Directory Manager" -w password --set ecl-include:"cn"
From now on, next changelog entries will contain 'includedAttributes' attribute with old 'cn' value, which is 'Peter'.

Related

Nifi add flow file attributes to S3 Object (PutS3Object) Metadata

I have a simple flow consisting of
GenerateFlowFile ----> PutS3Object ----> Wait
And the generated flow files are getting stored in the bucket correctly.
Now I want to add Metadata to my flow file.
If I add a property "Test1" to PutS3Object, it shows up as "X-Amz-Meta-Test1" in the metadata of the object.
But if I add a property "Test2" in GenerateFlowFile it doesn't show up in metadata.
I tried adding "Test2" as s3.usermetadata.Test2 but it still didn't work.
Is there a way to pass all the flow files attributes as metadata without explicitly adding properties in the PutS3Object.
PutS3Object only inserts metadata values that you have set as Dynamic Properties on the PutS3Object processor itself. Please see the docs link and look at the Dynamic Properties section.
PutS3Object does not just stick any Attribute you set as metadata, otherwise you would end up with potentially hundreds of metadata entries that you aren't interested in. The only Attribute it reads by default is filename - please see the Reads Attributes section of the docs.
If you have an existing Attibute, and you want to push the value of this Attribute into the metadata, you must add a Dynamic Property to PutS3Object and reference the value of the Attribute.
E.g. you have an Attribute called file_author with a value Steve and you want the S3 object to have the metadata field author with the value Steve:
You would add a Dynamic Property to PutS3Object with a name of author and a value of ${file_author}.
Edit:
You could fork PutS3Object into a custom processor to add the dynamic functionality you want, but I would recommend just using the standard PutS3Object config and manually configuring the Attributes you want.

How to get Gerrit detail from change-id existing in different projects?

I would like to get change detail from change_id assume 123
Using GERRIT API:
https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-change-detail
But In such a case it throws error:
HTTP Error 404: Not Found
!! CODE=404 !! None -> b'Multiple changes found for 123\n' # http://<GERRIT_SERVER>/a/changes/123/detail
The problem is that there are changes with same change_id in multiple projects.
Same command works properly when I try to get detail for change_id which exists only in single project.
Do you know some workaround for such a case?
Add the project to the search.
See the Gerrit documentation here.
{change-id}
Identifier that uniquely identifies one change. It contains the URL-encoded project name as well as the change number: "'~'"
Gerrit also supports the following identifiers:
an ID of the change in the format "'~~'",
where for the branch the refs/heads/ prefix can be omitted
("myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940")
a Change-Id if it uniquely identifies one change
("I8473b95934b5732ac55d26311a706c9c2bde9940")
a numeric change ID ("4247")

Pentaho Kettle LDAP Output

How do I update the LDAP value using LDAP Output Step in Spoon?
I couldn't find any documentation on Pentaho's website. I am trying to update the group name of a particular user in Active Directory.
Until now, I was able to connect with the AD. But I can't make any changes to LDAP.
In General -> Settings, my operation is updated.
And in Fields -> Search Base, I defined the DC attributes. Eg: dc=xyz,dc=com.
And in Attributes, I defined the OU along with the value it should be changed too.
Is this how it should work?
I am getting an error saying "can not find DN(Distinguished Name) in the input stream!"
My guess is that you are using the values you want to inject instead of the fields containing those values. This step heavily relies upon fields coming in from previous steps.
In the image below you will see I am passing in the 'dn' field which is used in Settings > 'Dn fieldname' to lookup the field I want to alter.
Then under Fields I am mapping the incoming 'new_name' field to the property 'givenName' on the LDAP object identified by the DN.
So my DN to lookup and the value to set the field to are coming from my transformation stream. I only statically identify the Attribute on the LDAP object to be mapped.
the dn is not right. dn is cn + ou-structure like ou + domain-structure like dc.
If you dont know the cn, you cant define the dn. You must take a LDAP-Input with query like your uid for getting dn.
With this dn you can update attributes with LDAP-Output, if you have rights for writing.

Tortoise SVN property substitution - fails for more than one property "group"

I'm using TortoiseSVN 1.6.12, and seeing something very strange behaviour on property substitution. I have some svn:keyword properties (configured via TSVN) like this:
Author, LastChangedBy, Date, DateLastChanged
which I've applied recursively across every file in the codeset
I then did a simple test on a text file like this
Some text
$Author$
$LastChangedBy$
$Date$
$LastChangedDate$
When I commit my changes, the Author and LastChangedBy properties are substituted but not the Date or LastChangedDate ones. I did some experimenting around combinations and it appears that either the author properties are set, or the date ones (but never both). So it must be doing some validation based on property groups. (In TSVN, you can't simply created another svn:keywords entry, you're stuck with one).
Has anyone ever encountered this and/or is there a workaround?
The problem you have is simply based on that SVN only replaces keywords which are known to SVN.
You are using the following list of keywords set:
Author, LastChangedBy, Date, DateLastChanged
but you have placeholders set in your text file:
$Author$
$LastChangedBy$
$Date$
$LastChangedDate$
the known keywords are the following:
URL, HeadURL
Author, LastChangedBy
Date, LastChangedDate
Rev, Revision
LastChangedRevision
Id
Header
The problem you have that svn:keywords must exactly represents the keywords you would like to replace with values. But be aware that keywords are case sensitive. Furthermore you have defined a keyword "DateLastChanged" which does simply not exist and will of course not be replaced by SVN, cause it's unknown by SVN. On the other hand i assume you have a typo in your svn:keywords contents. may be you can copy&past the output of
svn pl . -v filename
on command line on that file. One point i missed before have you separated the keywords with a space?

What is the proper way to set and update the contents of a field on a node in Drupal 7?

I've written a Drupal 7 module that creates a custom node type. I've added a number_integer field to the node, to act as a counter. How do I set the counter field to default to zero, when a node gets created?
Next, while processing the node, I need to increase the value of the counter by one and save the new value. Do I do that by altering the $node object and then calling node_save? Or is there a better way, using the Field API or something?
I still would not really dare to save back a node just like that. I would still use
$form_state = array('values' => array());
drupal_form_submit('story_node_form', $form_state, $node);
much like we did in Drupal 6 (just with slightly different syntax).