saltstack-formulas / samba-formula

http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html
Other
16 stars 72 forks source link

Fix idmap config 'schema_mode' syntax in yaml #44

Closed noelmcloughlin closed 6 years ago

noelmcloughlin commented 6 years ago

Problem with #42 Should defaults.yaml have ....

idmap config *:schema_mode = rfc2307 (suspected bad yaml syntax)

OR

'idmap config *:schema_mode = rfc2307'

OR

'idmap config *:schema_mode: rfc2307' (suspected bad samba syntax)

noelmcloughlin commented 6 years ago

@qno This maybe yaml rendering error as syntax appears correct.

Could you try instead 'idmap config *:schema_mode = rfc2307' to see if yaml is problem?

qno commented 6 years ago

@noelmcloughlin - I tried but doesn't work either.

noelmcloughlin commented 6 years ago

Reverted in #45 until I get time to troubleshoot. thanks for reporting @qno

qno commented 6 years ago

Hi,

so I looked again into this problem and I realized that this is maybe a "multiple same key" error, because of the range defintion above, which has the same idmap config * key. Then I tried to rewrite the settings like this:

idmap config *: 
   - range = 16777216-33554431
   - schema_mode = rfc2307

This gave no YAML rendering error. But I don't use this settings and I don't see the rendered config file settings. Someone else has to try this out to see if this solves the problem.

noelmcloughlin commented 6 years ago

Maybe yaml reports duplicate keys this way :-)

    Rendering SLS 'base:samba.config' failed: Jinja syntax error: Encountered error loading yaml: could not found expected ':'

Thanks, yes I'll test this when I get time.

Yes you are correct. These are only rendered if you want Active Directory integration for users which is activated by pillar data below. Otherwise they are not included in smb.conf if I remember correctly.

## Definitions to extend and override defaults

samba:
  role: ROLE_DOMAIN_MEMBER
qno commented 6 years ago

Hello,

so I checked my approach and it was not working correct. Now I tried another approach which has worked:

"idmap config * : range": 16777216-33554431
"idmap config * : schema_mode": rfc2307

The rendered config result was this, like in the Idmap_config_ad:

...
       [global]

                  +      allow trusted domains = False
                         bind interfaces only = False
                  +      client signing = True
                  +      client use spnego = True
                         dns proxy = no
                  +      domain master = False
                  +      encrypt passwords = True
                         hosts allow = 127. 10. 192.168.
                  +      idmap config * : range = 16777216-33554431
                  +      idmap config * : schema_mode = rfc2307
                  +      kerberos method = secrets and keytab
                         load printers = True
                  +      local master = False
                         log file = /var/log/samba/log.%m
                         map to guest = bad user
...
noelmcloughlin commented 6 years ago

Thanks for discovering the problem. See https://pyyaml.org/wiki/YAMLColonInFlowContext (and https://docs.saltstack.com/en/latest/topics/troubleshooting/yaml_idiosyncrasies.html ). This stuff catches us out. Feel free to raise a PR to fix this.

On Tue, Jul 31, 2018 at 11:47 AM Silvio Kunaschk notifications@github.com wrote:

Hello,

so I checked my apporach and it was not working correct. Now I tried another approch which has worked:

"idmap config : range": 16777216-33554431"idmap config : schema_mode": rfc2307

The rendered config result was this, like in the Idmap_config_ad https://wiki.samba.org/index.php/Idmap_config_ad:

   [global]

              +      allow trusted domains = False
                     bind interfaces only = False
              +      client signing = True
              +      client use spnego = True
                     dns proxy = no
              +      domain master = False
              +      encrypt passwords = True
                     hosts allow = 127. 10. 192.168.
              +      idmap config * : range = 16777216-33554431
              +      idmap config * : schema_mode = rfc2307
              +      kerberos method = secrets and keytab
                     load printers = True
              +      local master = False
                     log file = /var/log/samba/log.%m
                     map to guest = bad user

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/saltstack-formulas/samba-formula/issues/44#issuecomment-409178057, or mute the thread https://github.com/notifications/unsubscribe-auth/AMtKQul1oGFZ3N5nAqIQN-OixrOL1mYFks5uMDXAgaJpZM4VlZzX .