Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manage Python related .dotfiles (for a user) #87

Closed
igalic opened this issue May 30, 2014 · 7 comments · Fixed by #164
Closed

Manage Python related .dotfiles (for a user) #87

igalic opened this issue May 30, 2014 · 7 comments · Fixed by #164
Labels
enhancement New feature or request

Comments

@igalic
Copy link
Contributor

igalic commented May 30, 2014

There are a handful of Python related dotfiles, which don't seem to have a global option in /etc (or if they do, it's not documented)

In our very old fork of this module, we have a defined type python::dotfiles, which manages:

  • .pypirc
  • .pydistutils.cfg
  • .pip
  • .pip/pip.conf

The main reason why we need this is because so we can direct our jenkins builds against our internal PyPy repository.

Is there any interest for such an extension to this module?

@igalic
Copy link
Contributor Author

igalic commented May 30, 2014

it might be valuable to have a python::dotfiles::config class where all manner of variables could be set (in Hiera), which are then used as defaults in this defined type…

@shivapoudel
Copy link
Contributor

patches are urgently welcome!

@igalic
Copy link
Contributor Author

igalic commented Aug 11, 2014

I'll try to make a proposal here during the day

@igalic
Copy link
Contributor Author

igalic commented Aug 11, 2014

the day needs more hours, or less meetings.

@igalic
Copy link
Contributor Author

igalic commented Jan 20, 2015

i have now solved this issue with a private (general) defined type (in a profile)

define profile::python::dotfile (
  $ensure   = 'present',
  $filename = $title,
  $owner    = 'root',
  $group    = 'root',
  $mode     = '0644',
  $config   = {},
) {
  $parent_dir = dirname($filename)

  exec { "create ${title}'s parent dir":
    command => "install -o ${owner} -g ${group} -d ${parent_dir}",
    creates => $parent_dir,
  }

  file { $filename:
    ensure  => $ensure,
    owner   => $owner,
    group   => $group,
    content => template("${module_name}/inifile.erb"),
    require => Exec["create ${title}'s parent dir"],
  }
}

the template is simply:

# this file is managed by puppet
<%- @config.map do |section,conf| -%>
[<%= section -%>]
<%-   conf.map do |key,value| -%>
<%= key %> = <%= value %>

<%-   end -%>
<%- end -%>

@shivapoudel
Copy link
Contributor

@igalic it will be better if you submit the Pull Request xD

@igalic
Copy link
Contributor Author

igalic commented Jan 27, 2015

okay!

shivapoudel pushed a commit that referenced this issue Sep 1, 2015
python dotfiles are user-based ini-files.
this defined type gives our users the ability to define arbitrary python
related .dotfiles. (actually: arbitrary ini-files ;)

This pr closes #87
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants