Skip to content
This repository was archived by the owner on Feb 10, 2018. It is now read-only.

Commit 4be7234

Browse files
authored
Merge pull request #110 from napalm-automation/develop
Release 0.6.2
2 parents 30d2f60 + 8158c01 commit 4be7234

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

napalm_junos/templates/delete_users.j2

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
11
system {
22
login {
33
{%- for user_name, user_details in users.items() -%}
4-
{%- if user_details -%}
4+
{%- if user_details and (user_details.get('password') and user_details.get('sshkeys')) -%}
55
user {{user_name}} {
66
authentication {
77
{%- if user_details.get('password') -%}
88
delete: encrypted-password "{{user_details.password}}";
99
{%- endif -%}
1010
{%- if user_details.get('sshkeys') -%}
1111
{%- for sshkey in user_details.sshkeys -%}
12+
{%- if sshkey.split()[0] == 'ssh-dss' -%}
1213
delete: {{ sshkey.split()[0] }} "{{ sshkey }}";
14+
{%- else -%}
15+
delete: ssh-dss "{{ sshkey }}";
16+
{%- endif -%}
1317
{%- endfor -%}
1418
{%- endif -%}
19+
}
20+
}
1521
{%- else -%}
1622
delete: user {{user_name}};
1723
{% endif -%}

napalm_junos/templates/set_users.j2

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,28 @@ system {
22
login {
33
{%- for user_name, user_details in users.items() -%}
44
user {{user_name}} {
5+
{%- if user_details.get('password') or user_details.get('sshkeys') -%}
56
authentication {
67
{%- if user_details.get('password') -%}
78
plain-text-password "{{user_details.password}}";
89
{%- endif -%}
910
{%- if user_details.get('sshkeys') -%}
1011
{%- for sshkey in user_details.sshkeys -%}
12+
{%- if sshkey.split()[0] == 'ssh-dss' -%}
13+
ssh-dsa "{{ sshkey }}";
14+
{%- else -%}
1115
{{ sshkey.split()[0] }} "{{ sshkey }}";
16+
{%- endif -%}
1217
{%- endfor -%}
1318
{%- endif -%}
1419
}
20+
{%- endif -%}
1521
{% set user_level = user_details.level|default(0) -%}
1622
{%- if user_level == 15 -%}
1723
class super-user;
18-
{%- elif user_level == 5 -%}
24+
{%- elif user_level < 15 and user_level >= 5 -%}
1925
class operator;
20-
{%- elif user_level == 1 -%}
26+
{%- elif user_level < 5 and user_level >=1 -%}
2127
class read-only;
2228
{% elif user_level == 0 -%}
2329
class unauthorized;

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
setup(
1414
name="napalm-junos",
15-
version="0.6.1",
15+
version="0.6.2",
1616
packages=find_packages(),
1717
author="David Barroso, Mircea Ulinic",
1818

0 commit comments

Comments
 (0)