mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-02 19:32:47 +00:00
applies code review suggestions
This commit is contained in:
@@ -10,8 +10,7 @@ __metaclass__ = type
|
||||
|
||||
import re
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils import cmd_runner_fmt
|
||||
from ansible_collections.community.general.plugins.module_utils.cmd_runner import CmdRunner
|
||||
from ansible_collections.community.general.plugins.module_utils.cmd_runner import CmdRunner, cmd_runner_fmt
|
||||
|
||||
__state_map = {
|
||||
"present": "--install",
|
||||
@@ -113,7 +112,7 @@ class AndroidSdkManager(object):
|
||||
with self.runner('state name sdk_root channel', data=data) as ctx:
|
||||
rc, stdout, stderr = ctx.run(name=command_arg, data=data)
|
||||
|
||||
data = stdout.split('\n')
|
||||
data = stdout.splitlines()
|
||||
|
||||
for line in data:
|
||||
if self._RE_ACCEPT_LICENSE.match(line):
|
||||
@@ -124,7 +123,7 @@ class AndroidSdkManager(object):
|
||||
return rc, stdout, stderr
|
||||
|
||||
def _try_parse_stderr(self, stderr):
|
||||
data = stderr.split('\n')
|
||||
data = stderr.splitlines()
|
||||
for line in data:
|
||||
unknown_package_regex = self._RE_UNKNOWN_PACKAGE.match(line)
|
||||
if unknown_package_regex:
|
||||
@@ -133,7 +132,7 @@ class AndroidSdkManager(object):
|
||||
|
||||
@staticmethod
|
||||
def _parse_packages(stdout, header_regexp, row_regexp):
|
||||
data = stdout.split('\n')
|
||||
data = stdout.splitlines()
|
||||
|
||||
updatable_section_found = False
|
||||
i = 0
|
||||
|
||||
@@ -145,15 +145,10 @@ class AndroidSdk(StateModuleHelper):
|
||||
self.vars.set('removed', [], change=True)
|
||||
|
||||
def _parse_packages(self):
|
||||
arg_pkgs = self.vars.package
|
||||
packages = set()
|
||||
for arg_pkg in arg_pkgs:
|
||||
package = Package(arg_pkg)
|
||||
packages.add(package)
|
||||
|
||||
if len(packages) < len(arg_pkgs):
|
||||
arg_pkgs = set(self.vars.package)
|
||||
if len(arg_pkgs) < len(self.vars.package):
|
||||
self.do_raise("Packages may not repeat")
|
||||
return packages
|
||||
return set([Package(p) for p in arg_pkgs])
|
||||
|
||||
def state_present(self):
|
||||
packages = self._parse_packages()
|
||||
|
||||
Reference in New Issue
Block a user