Commit graph

19 commits

Author SHA1 Message Date
Adrian Likins
8fdb068d7a Fix default perm for apt_repo files. (#4072)
Change the file mode arg to 'raw' ala file args

Following the file_common_args model, change the
type of the 'mode' arg here to type='raw' with no
default arg value.

The default mode for file creation is the module
constant DEFAULT_SOURCES_PER, and is used if no
mode os specified.

A default mode of 0644 (and not specified as int or str)
would get converted to an octal 420, resulting in the
sources file being created with mode '0420' instead of '0644'

Fixes #16370
2016-07-01 13:10:32 -04:00
Michael Scherer
75715a1b73 Convert packaging/* to py3/py2.4 syntax (#3702) 2016-05-20 07:48:10 -07:00
Tobias Wolf
c5be97ca5c Add diff support to apt_repository module
The returned list of diffs aims to simulate how a file system diff would
look before and after writing the sources list files.

![screenshot](http://i.imgur.com/dH6QXtY.png)

n.b. Ternary conditional  is due to failing integration test for
python 2.4
2016-03-04 12:37:28 +01:00
Matt Clay
7a82f2c86d Show error if python-apt is absent in check mode.
Previously this would fail with an exception which
did not clearly explain the reason for the failure.
2016-01-31 01:32:09 -08:00
Brian Coca
9e5737d776 Merge pull request #2661 from mscherer/remove_unsafe_shell_apt_repos
Split a shell snippet in 2 to avoid using use_unsafe_shell=True
2016-01-25 23:45:02 -05:00
Matt Clay
9f622015f1 Added filename option to apt_repository module. 2015-12-15 23:48:33 -08:00
Michael Scherer
8c5e8f0425 Split a shell snippet in 2 to avoid using use_unsafe_shell=True
Since use_unsafe_shell is suspicious from a security point
of view (or it wouldn't be unsafe), the less we have, the less
code we have to toroughly inspect for a security audit.

In this case, the '&&' can be replaced by doing 2 calls to run_command.
2015-12-10 00:20:13 +01:00
Pierre-Louis Bonicoli
2fdb197245 fix error occurring with Debian
Error was: AttributeError: 'SourcesList' object has no attribute 'repos_urls'
2015-07-30 13:16:56 +05:30
Abhijit Menon-Sen
74a27ffe52 Simplify distribution test
If it's Ubuntu, use UbuntuSourcesList; if it's any other apt-friendly
distribution, use SourcesList; otherwise, fail.
2015-07-30 13:16:56 +05:30
Abhijit Menon-Sen
44d16240a8 Make SourcesList __init__ method also set self.module
This was originally required to allow other methods in SourcesList to
fail, but subsequent changes rendered that unnecessary, and it's just
a cleanup now, and avoids passing in module separately to save().
2015-07-30 13:11:43 +05:30
Abhijit Menon-Sen
6afa1da910 Clarify HAVE_PYTHON_APT/install_python_apt handling in apt_repository
1. Don't test check_mode in both the caller and in the callee.
2. Don't test HAVE_PYTHON_APT inside an if that tests HAVE_PYTHON_APT
3. Don't be irritatingly vague about why the module fails ("You may be
   seeing this because…").

Note that if «apt-get -y install python-apt» succeeds with rc==0, but
for some reason python_apt is not usable afterwards, this will break
because the imports in install_python_apt aren't wrapped inside a
try/except.

In other words, we assume that install_python_apt either succeeds or
fails with a traceback. This commit doesn't affect that behaviour.
2015-07-30 13:03:10 +05:30
Abhijit Menon-Sen
653fd34ed7 Fix call to _expand_ppa 2015-07-30 09:02:18 +05:30
verm666
d435d5ce0a This change is in response to issue #133.
The original problem is: apt_repository.py connect to launchpad on
every playbook run. In this patch apt_repository.py checks if required
repository already exists or not. If no - paa will be added, if yes -
just skip actions.
2015-06-25 10:56:29 -07:00
Toshio Kuratomi
50912c9092 Fix apt_repository so that it does not modify the mode of existing repositories 2015-06-24 16:32:47 -07:00
Toshio Kuratomi
720632f568 Merge pull request #338 from pilou-/apt_repository_filemode
apt_repository: fix file mode
2015-06-24 16:01:45 -07:00
Greg DeKoenigsberg
2a5f0bde87 Proper author info for all remaining modules 2015-06-15 15:53:30 -04:00
Matt Martz
7ca732830f Python2.4 fixes
* Ignore accelerate.py
* Don't use a lambda or a ternary
2015-05-11 11:04:44 -05:00
Pierre-Louis Bonicoli
9ca27eedcc apt_repository: fix file mode
'set_mode_if_different' method should be called on dest filename and after
'atomic_move' method
2014-11-16 01:13:29 +01:00
Michael DeHaan
3ed1378067 Some more module categorization. 2014-11-04 17:23:22 -05:00
Renamed from packaging/apt_repository.py (Browse further)