Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _install_package(self):
if self.install_method.lower() == 'yum':
self._install_from_yum(self.yum_pkgs)
elif self.install_method.lower() == 'git':
salt_bootstrap_filename = os.sep.join((
self.working_dir,
watchmaker.utils.basename_from_uri(self.bootstrap_source)
))
self.retrieve_file(self.bootstrap_source, salt_bootstrap_filename)
bootstrap_cmd = [
'sh',
salt_bootstrap_filename,
'-g',
self.git_repo
]
if self.salt_version:
bootstrap_cmd.append('git')
bootstrap_cmd.append(self.salt_version)
else:
self.log.debug('No salt version defined in config.')
self.call_process(bootstrap_cmd)
def install(self):
"""Install yum repos defined in config file."""
self._validate_config()
for repo in self.yumrepomap:
if self._validate_repo(repo):
# Download the yum repo definition to /etc/yum.repos.d/
self.log.info('Installing repo: %s', repo['url'])
url = repo['url']
repofile = '/etc/yum.repos.d/{0}'.format(
watchmaker.utils.basename_from_uri(url))
self.retrieve_file(url, repofile)
else:
self.log.debug(
'Skipped repo because it is not valid for this system: '
'dist_info=%s',
self.dist_info
)
self.log.debug('Skipped repo=%s', repo)
def _install_package(self):
installer_name = os.sep.join((
self.working_dir,
watchmaker.utils.basename_from_uri(self.installer_url)
))
self.retrieve_file(self.installer_url, installer_name)
install_cmd = [installer_name, '/S']
self.call_process(install_cmd)
def _build_salt_formula(self, extract_dir):
if self.salt_content:
salt_content_filename = watchmaker.utils.basename_from_uri(
self.salt_content
)
salt_content_file = os.sep.join((
self.working_dir,
salt_content_filename
))
self.retrieve_file(self.salt_content, salt_content_file)
if not self.salt_content_path:
self.extract_contents(
filepath=salt_content_file,
to_directory=extract_dir
)
else:
self.log.debug(
'Using salt content path: %s',
self.salt_content_path