diff --git a/bundles/users/files/config.fish b/bundles/users/files/fish.conf similarity index 100% rename from bundles/users/files/config.fish rename to bundles/users/files/fish.conf diff --git a/bundles/users/items.py b/bundles/users/items.py index 5c5ab5a..7dce1b8 100644 --- a/bundles/users/items.py +++ b/bundles/users/items.py @@ -1,3 +1,5 @@ +from os.path import join, exists + directories = {} users = {} files = {} @@ -51,16 +53,32 @@ for username, attrs in node.metadata['users'].items(): else: files[home + '/.ssh/authorized_keys'] = {'delete': True} + if exists(join(repo.path, 'data', 'users', 'files', 'tmux', '{}.conf'.format(username))): + tmux_src = 'tmux/{}.conf'.format(username) + else: + tmux_src = 'tmux.conf' + files[home + '/.tmux.conf'] = { 'content_type': 'mako', - 'source': 'tmux.conf', + 'source': tmux_src, } + + if exists(join(repo.path, 'data', 'users', 'files', 'fish', '{}.conf'.format(username))): + fish_src = 'fisk/{}.conf'.format(username) + else: + fish_src = 'fish.conf' + files[home + '/.config/fish/config.fish'] = { 'content_type': 'mako', + 'source': fish_src } - -for user, config in users.items(): - files[config['home'] + '/.bashrc'] = { - 'delete': True, - } + if exists(join(repo.path, 'data', 'users', 'files', 'bash', '{}.bashrc'.format(username))): + files[home + '/.bashrc'] = { + 'content_type': 'mako', + 'source': 'bash/{}.bashrc'.format(username), + } + else: + files[home + '/.bashrc'] = { + 'delete': True, + }