Ok, i could add a connection, but it is a system connection.
As far as i noted, in order to this connection I created be detected by the
scripts i'm using, it has to be a user connection.
How to create a user connection in the command line?


s_con = { 'id': 'XXX', 'uuid': '5ef2d781-1197-44eb-8744-cd78b9c07315',
'type': '802-11-wireless', 'autoconnect': False, 'name': 'connection' }

s_wifi = { 'ssid': dbus.ByteArray("XXX"), 'mode': 'infrastructure',
'security': '802-11-wireless-security', 'name': '802-11-wireless' }

s_wsec = { 'key-mgmt': 'wpa-psk', 'wpa-key': 'xxx', 'name':
'802-11-wireless-security' }

s_ip4 = { 'method': 'auto', 'name': 'ipv4' }

con = { 'connection': s_con, '802-11-wireless': s_wifi,
'802-11-wireless-security': s_wsec, 'ipv4': s_ip4 }


sys_bus = dbus.SystemBus()
ses_bus = dbus.SessionBus()
proxy = sys_bus.get_object("org.freedesktop.NetworkManagerSystemSettings",
"/org/freedesktop/NetworkManagerSettings")
iface = dbus.Interface(proxy, "org.freedesktop.NetworkManagerSettings")

try:
    iface.AddConnection(con)
except Exception, e:
    print e

On Mon, Jul 19, 2010 at 7:03 PM, Daniel Gnoutcheff
<[email protected]>wrote:

> On 07/19/2010 09:27 AM, Arlen Nascimento wrote:
> > It is possible to do it by means of dbus commands or something?
> > examples?
>
> Here's one:
>
> http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/python/add-system-connection.py
>
> dbus-send(1) probably could do the job as well, e.g. if you prefer to
> use shell scripts. These documents may be helpful as well:
> http://projects.gnome.org/NetworkManager/developers/spec-08.html
> http://projects.gnome.org/NetworkManager/developers/settings-spec-08.html
>
> And to make the connection "run" without user intervention, you only
> need to ensure that the "autoconnect" flag is "true". In fact, that flag
> is "true" by default, so you won't really need to do anything.
>
> Note that adding a system connection is a one-shot deal; you only need
> to do it once. So if you can afford to use a GUI tool just once, you'll
> probably find that nm-connection-editor is a much easier way to do it.
> (Just check "Available for all users", and it'll get installed as a
> system connection.)
>
> Have a good one,
> Daniel
>
> > On Mon, Jul 19, 2010 at 2:26 PM, Daenyth Blank <[email protected]
> > <mailto:[email protected]>> wrote:
> >
> >     On Mon, Jul 19, 2010 at 09:11, Arlen Nascimento
> >     <[email protected] <mailto:[email protected]>>
> wrote:
> >     > Ok, but the thing is: i need to setup and "run" a connection
> >     without the
> >     > user intervention
> >     In that case you need to create a new connection with the options
> >     you want.
>



-- 
Arlen Nascimento
_______________________________________________
networkmanager-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/networkmanager-list

Reply via email to