I'm trying to create a custom AttributeType with OpenLDAP without success...
I have a very basic/default LDAP configuration using the cn=config method.
My goal is to create a custom attribute type "memberOfGroups" for my generic user accounts. The syntax shall validate at least this kind of regular expression: [a-zA-Z0-9]+(,[a-zA-Z0-9]+)* in other words one,or,several,words,separated,by,comma.
So, first of all, I think I should create a new olcAttributeTypes, then modify the inetorgperson and add this Attribute type. Am I right?
This is my ldif file:
# cat -A ~/add_attribute.ldif
version: 1$
$
dn: cn={4}custom,cn=schema,cn=config$
changetype: modify$
add: olcAttributeTypes$
olcAttributeTypes: ( 1.3.6.1.4.1.1234.1$
NAME 'memberOfGroups'$
DESC 'Appartenance a un groupe.'$
SYNTAX 1.3.6.1.4.1.1466.115.121.1.44 )$
And I'm using the following ldapmodify command:
# ldapmodify -xf ~/add_attribute.ldif -D 'cn=admin,dc=ldap,dc=jlo,dc=lab' -W
The result is:
modifying entry "cn={4}custom,cn=schema,cn=config"
ldap_modify: No such object (32)
matched DN: cn=schema,cn=config
So I tried :
with ldapadd command, with the same result.
changing the "changetype" to "add", not working too.
Then I'm asking myself if I'm using the right DN. Indeed, the cn={4}custom file doesn't exist yet in the /etc/ldap/slapd.d/cn=config/cn=schema directory.
Should I create it before or will it be automatically created?
I'm a little confused with the LDAP configuration...
Thanks in advance for any help.
I progressed (a little). I created a new file for my custom attributes. This is my ldif:
dn: cn={4}custom,cn=schema,cn=config
changetype: add
objectClass: olcSchemaConfig
cn: custom
dn: cn={4}custom,cn=schema,cn=config
changetype: modify
add: olcAttributeTypes
olcAttributeTypes: ( 1.3.6.1.4.1.1234.1
NAME 'memberOfGroups'
DESC 'Appartenance a un groupe.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.44 )
But don't see the memberOfGroups attribute in phpldapadmin > schema > attribute types. I don't now if this is a phpldapadmin problem or not.
Then, I think I should associate this attribute to the inetOrgPerson objectclass.
Related
I simply want to see my download and upload data in the map section but i couldnt figure out the code.
For example = When i use this ( ''{HOSTNAME : net.if.speed[Interface ge.2.47()].last()}'' ) command it says UNKNOWN but I dont know where im doing wrong.
Also tried using ( net.if.in[Interface ge.2.47(Uplink)]:last()} ) but its still not showing any data.
You can use this:
In: {systemname.with.zabbix:ifInOctets[ppp0].last(0)}
Out: {systemname.with.zabbix:ifOutOctets[ppp0].last(0)}
Of course you have to replace the systemname and the interface name (ppp0)
You find the interface names in the items section of the host. (Of course you must have some kind of agent or snmp activated on that host)
Any one can explain how to get table list via Drill REST API.
I have tried with show database -> use mysql.db -> show table list
Able to get DB list but not able to get table list from respective DB.
Thanks in advance.
EDIT FROM COMMENT
My JSON request like this first :
{ "queryType" : "SQL", "query" : "USE MYSQL.dbtest" }
I got default schema result, then I sent
{ "queryType" : "SQL", "query" : "SHOW TABLES" }
then i got exception like this
org.apache.drill.common.exceptions.UserRemoteException: VALIDATION ERROR: No default schema selected. Select a schema using 'USE schema' command [Error Id: e4e2d2f4-6f08-4ef9-9be3-ba3bbe2d20d9 on spark-slave:31010]
It is very hard to help with little information. Since you provided no information about your JSON request strings I have to assume.
First, https://drill.apache.org/docs/rest-api/#query shows that you can send a query to Drill. This might be what you have used.
Secondly, there is no command show table list. Even directly in Drill, this shouldn't work. The correct command, also to be found in the documentation under https://drill.apache.org/docs/show-tables/ is SHOW TABLES;
If you need any further help, please add more information.
EDIT
It seems that Drill is not "remembering" your USE command. Maybe a new session is being opened. To avoid needing to use USE, you could try including the database identifier in your SHOW statement.
{ "queryType" : "SQL", "query" : "SHOW MYSQL.dbtest.TABLES" }
I am not sure if that is possible, though. What should work is using the SELECT statement:
{ "queryType" : "SQL", "query" : "SELECT * FROM MYSQL.dbtest.<a_table_name>" }
I have transfered my project from MySQL to PostgreSQL and tried to drop the column as result of previous issue, because after I removed the problematic column from models.py and saved. error didn't even disappear. Integer error transferring from MySQL to PostgreSQL
Tried both with and without quotes.
ALTER TABLE "UserProfile" DROP COLUMN how_many_new_notifications;
Or:
ALTER TABLE UserProfile DROP COLUMN how_many_new_notifications;
Getting the following:
ERROR: relation "UserProfile" does not exist
Here's a model, if helps:
class UserProfile(models.Model):
user = models.OneToOneField(User)
how_many_new_notifications = models.IntegerField(null=True,default=0)
User.profile = property(lambda u: UserProfile.objects.get_or_create(user=u)[0])
I supposed it might have something to do with mixed-case but I have found no solution through all similar questions.
Yes, Postgresql is a case aware database but django is smart enough to know that. It converts all field and it generally converts the model name to a lower case table name. However the real problem here is that your model name will be prefixed by the app name. generally django table names are like:
<appname>_<modelname>
You can find out what exactly it is by:
from myapp.models import UserProfile
print (UserProfile._meta.db_table)
Obviously this needs to be typed into the django shell, which is invoked by ./manage.py shell the result of this print statement is what you should use in your query.
Client: DataGrip
Database engine: PostgreSQL
For me this worked opening a new console, because apparently from the IDE cache it was not recognizing the table I had created.
Steps to operate with the tables of a database:
Database (Left side panel of the IDE) >
Double Click on PostgreSQL - #localhost >
Double Click on the name of the database >
Right click on public schema >
New > Console
GL
In mysql 5.6 a new parameter histignore is introduced to avoid writing of history file for some particular keywords.
I run the mysql shell by setting two string in histignore parameter as:
./bin/mysql --histignore="*UPDATE*:*DELETE*"
I want to know how to check this variable current values ?
Whats the command to check present values of this variable ?
I got the solution:
We need to set the variable as:
export MYSQL_HISTIGNORE="*INSERT*"
and we can check via command :
printenv MYSQL_HISTIGNORE
I was trying my first 'Helloworld' application in Cassandra. Whenever I try to add any data to my keyspace column family I get this error:
[default#MyKeyspace] set User['ehewitt'] ['fname']='Eben';
org.apache.cassandra.serializers.MarshalException: cannot parse 'fname' as hex bytes
This is despite the fact that I have executed
[default#MyKeyspace] assume Users keys as utf8;
So the above command does not seem to have any effect at all. How do I solve this issue?
Cassandra is assuming the columns as bytes.
Check with
help assume;
assume User keys as ascii;
assume User comparator as ascii;
assume User validator as ascii;
assume User sub_comparator as ascii;
set User['ehewitt']['fname']='Eben';
Value inserted.
Elapsed time: 216 msec(s).
I had similar problem, but the cli told me that the value is what cannot be parsed.
set game_outcome['1']['userId']='123asdasd';
cannot parse '123asdasd' as hex bytes
so I tried to use utf8 function like this :
set game_outcome['1']['userId']=utf8('123asdasd');
cannot parse '123asdasd' as hex bytes
Try
set User['ehewitt'] [utf8('fname')]='Eben'
I tried to use set some assumption like this
assume validator keys as utf8;
validator not found in current keyspace.
But as you can see it did not work as well !
I hope this answer helps.
Starting the CLI
You can start the CLI using the bin/cassandra-cli script in your Cassandra installation (bin\cassandra-cli.bat on windows). If you are evaluating a local cassandra node then be sure that it has been correctly configured and successfully started before starting the CLI.
If successful you will see output similar to this:
Welcome to cassandra CLI.
Type 'help;' or '?' for help. Type 'quit;' or 'exit;' to quit.
You must then specify a system to connect to:
connect localhost/9160;
Creating a Keyspace
We first create a keyspace to run our examples in.
create keyspace Twissandra;
Selecting the keyspace to user
We must then select our example keyspace as our new context before we can run any queries.
use Twissandra;
To Create A Column
We can then create a column to play with.
create column family User with comparator = UTF8Type;
For the later examples to work you must also update the schema using the following command. This will set the return type for the first and last name to make them human readable. It will also add and index for the age field so that you filter your gets using the Users name field.
update column family User with
column_metadata =
[
{column_name: first, validation_class: UTF8Type},
{column_name: last, validation_class: UTF8Type},
{column_name: age, validation_class: UTF8Type, index_type: KEYS}
];
To Add Data
To add data we want to into our new column we must first specify our default key type otherwise we would have to specify it for each key using the format [utf8('keyname')] this is probably advisable if you have mixed key types but makes simple cases harder to read.
So we run the command below, which will last the length of you cli session. On quitting and restarting we must run it again.
assume User keys as utf8;
and then we add our data.
set User['jsmith']['first'] = 'John';
set User['jsmith']['last'] = 'Smith';
set User['jsmith']['age'] = '38';
If you get the error like this cannot parse 'John' as hex bytes, then it likely you either haven't set your default key type or you haven't updated your schema as in the create column example.
To Update Data
If we need to update a value we simply set it again.
set User['jsmith']['first'] = 'Jack';
To Get Data
Now let's read back the jsmith row to see what it contains:
get User['jsmith'];
The get command uses API#get_slice
To Query Data
get User where age = '12';