Re: Retrieving 'secret' setting

On 07 September 2017 at 17:13 Colin Helliwell <colin helliwell ln-systems com> wrote:

On 07 September 2017 at 16:37 Dan Williams <dcbw redhat com> wrote:

client =
c =
secrets =

# this merges
the secrets into the existing connection

# write the full connection back to NM

Thanks, I'll work through that in due course, but just to step back a bit to something perhaps simpler 
(which may help my understanding in general!) I've just been trying to modify some other gsm settings. All 
is good until trying to write the changes to the connection file (/etc/NetworkManager/system-connections/): does write to the file (I see the timestamp is changed), but the setting itself is unchanged, 
c.commit_changes(True,None) *does* alter the setting in there.

Just wondering therefore what save() is intended for, and/or whether it needs to be used in a different way?
No problem to use commit_changes() instead, but save() doesn't seem to be doing what the docs imply: "Saves 
the connection to disk if the connection has changes that have not yet been written to disk, or if the 
connection has never been saved"

Ok, think I get it now - I was seeing 'commit' as higher level as 'save'. But in fact commit is just on the 
loaded connections, with the option to save; and 'save' only saves what's been committed? 
Mind you I always seem to get False from get_unsaved(), regardless. (Not too bothered as I won't be using 
that ultimately - I just noticed it during my experimentation)

AND, just to get my next question in while I'm at it :) - What are the calls to do a down/reload/up on the 
connection? (i.e. I'll have changed the gsm settings from incorrect apn etc to correct, and want pppd to be 
kicked into a re-connect)

I still haven't sussed out how to do this....
(Not even sure of the class/api to be looking at)


An additional query about changing the gsm password. I'm basically able to do this, but I've noticed that it 
doesn't seem possible to *remove* the password. For example the username can be deleted [i.e. from the 
connection file] with      settings.set_property(NM.SETTING_GSM_USERNAME, None)

Password can be *changed* with a set_property() but if it's changed to None then the connection file - though 
it is rewritten - doesn't change. 

It can be emptied with     set_property(NM.SETTING_GSM_USERNAME, "")
this puts 'password=' into the file but then an error is thrown ("A password is required to connect to 
'GSM'"). Note - for clarity of permutations in this info, username is set.

A workaround seems to be to explicitly set it to an empty string:
  set_property(NM.SETTING_GSM_USERNAME, '""')

Not a major problem, but I wondered if it's a bit of a bug?  The same seems to occur doing it with a 'nmcli 
conn mod'
(I'm using the 1.8.2 tarball)

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]