Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
)
else:
sys.exit(
"Kindly provide an 'Admin' Bitbucket user with correct password and run the installer again!"
)
# Terraform provisioning script needs the jar file path
replace_tfvars('atlassian_jar_path',
get_atlassian_tools_path() + "lib/bitbucket-cli-6.7.0.jar",
get_tfvars_file())
replace_tfvars('scm_elb', bbelb, get_tfvars_file())
replace_tfvars('scm_username', bbuserpass[0], get_tfvars_file())
replace_tfvars('scm_passwd', bbuserpass[1], get_tfvars_file())
replace_tfvars('scm_publicip', bbip, get_tfvars_file())
replace_tfvars('scm_type', 'bitbucket', get_tfvars_file())
replace_tfvars('scm_pathext', '/scm', get_tfvars_file())
def configure_jenkins(endpoint, defaultport, userpw, sshuser, secgrp, subnet):
# Check is the jenkins user exist in jenkins server
if not check_jenkins_user(endpoint, defaultport, userpw):
sys.exit(
"Kindly provide an 'Admin' Jenkins user with correct password and run the installer again!"
)
check_jenkins_pem()
# Default Jenkins instance ssh Port
ssh_port = "22"
replace_tfvars('dockerizedJenkins', 'false', get_tfvars_file(), quoteVal=False)
update_jenkins_terraform(endpoint, defaultport, userpw, sshuser, ssh_port, secgrp, subnet)
def parseXML(self, xmlelement):
Node.parseXML(self, xmlelement)
for (at, av) in xmlelement.attributes.items():
if at == "ValueRank":
self.valueRank = int(av)
elif at == "AccessLevel":
self.accessLevel = int(av)
elif at == "UserAccessLevel":
self.userAccessLevel = int(av)
elif at == "MinimumSamplingInterval":
self.minimumSamplingInterval = float(av)
elif at == "DataType":
self.dataType = RefOrAlias(av)
elif at == "ArrayDimensions":
self.arrayDimensions = av.split(",")
for x in xmlelement.childNodes:
if x.nodeType != x.ELEMENT_NODE:
options.output_data_path)
config['packages'] = packages
if os.path.isdir(options.working_directory):
process = subprocess.Popen(['rm', '-rf', options.working_directory])
retval = process.wait()
process = subprocess.Popen(['mkdir', '-p',
os.path.join(options.working_directory, "photon-chroot")])
retval = process.wait()
config['working_directory'] = options.working_directory
# Run the installer
package_installer = Installer(config, rpm_path=options.rpm_path,
log_path=options.log_path)
package_installer.install(None)
# Making the iso if needed
if options.iso_path:
rpm_list = " ".join(
create_rpm_list_to_be_copied_to_iso(
options.pkg_to_rpm_map_file,
options.pkg_to_be_copied_conf_file, 1, options.output_data_path))
files_to_copy = " ".join(
create_additional_file_list_to_copy_in_iso(
os.path.abspath(options.stage_path), options.package_list_file))
live_cd = get_live_cd_status_string(options.package_list_file)
process = subprocess.Popen(['./mk-install-iso.sh', '-w',
options.working_directory, options.iso_path,
# if user not root (UID != 0)
elif os.getuid() != 0:
# multiple components require root access
Avalon.error('SCUTUM must be run as root')
Avalon.error('Exiting')
exit(1)
# privileged section
# set an exit code
exit_code = 0
try:
# initialize installer
installer = Installer(args.config)
if not (args.install or args.uninstall):
# Some objects don't need to be initialized during
# installation or uninstallation
interfaces, network_controllers, ufw_handled, arp_driver = read_config()
# Initialize objects
ac = ArpController()
if ufw_handled:
ufwctrl = Ufw()
# If '--install'
if args.install:
# Install scutum into system
installer.install()
def _indirection():
Toolbox().git(
module,
parameters,
destination=destination,
use_ssh=use_git_ssh,
verbose=True,
reference=reference_repository_path,
)
returncode = 1
Toolbox.set_git_repository_config_to_rebase(
os.path.join(destination, ".git", "config")
)
if returncode:
return returncode # no point trying to continue on error
# Show the hash for the checked out commit for debugging purposes, ignore any failures.
ShellCommand(
command=["git", "rev-parse", "HEAD"], workdir=destination
).run()
return returncode
filename = "%s-%s" % (module, urlparse(source_candidate)[2].split("/")[-1])
filename = os.path.join(destpath, filename)
if verbose:
print("===== Downloading %s: " % source_candidate, end=" ")
Toolbox.download_to_file(source_candidate, filename)
Toolbox.unzip(filename, destination, trim_directory=1, verbose=verbose)
return
error = (
"Cannot satisfy git dependency for module %s: None of the sources are available."
% module
)
if not git_available:
print(error)
error = "A git installation has not been found."
raise Exception(error)
returncode = ShellCommand(command=cmd, workdir=destpath).run()
if returncode:
return returncode # no point trying to continue on error
if reference_parameters:
# Sever the link between checked out and reference repository
cmd = ["git", "repack", "-a", "-d"]
returncode = ShellCommand(command=cmd, workdir=destination).run()
try:
os.remove(
os.path.join(
destination, ".git", "objects", "info", "alternates"
)
)
except OSError:
returncode = 1
Toolbox.set_git_repository_config_to_rebase(
os.path.join(destination, ".git", "config")
)
if returncode:
return returncode # no point trying to continue on error
# Show the hash for the checked out commit for debugging purposes, ignore any failures.
ShellCommand(
command=["git", "rev-parse", "HEAD"], workdir=destination
).run()
return returncode
filename = "%s-%s" % (module, urlparse(source_candidate)[2].split("/")[-1])
filename = os.path.join(destpath, filename)
if verbose:
print("===== Downloading %s: " % source_candidate, end=" ")
Toolbox.download_to_file(source_candidate, filename)
Toolbox.unzip(filename, destination, trim_directory=1, verbose=verbose)
return
Toolbox.set_git_repository_config_to_rebase(
os.path.join(destination, ".git", "config")
)
if returncode:
return returncode # no point trying to continue on error
# Show the hash for the checked out commit for debugging purposes, ignore any failures.
ShellCommand(
command=["git", "rev-parse", "HEAD"], workdir=destination
).run()
return returncode
filename = "%s-%s" % (module, urlparse(source_candidate)[2].split("/")[-1])
filename = os.path.join(destpath, filename)
if verbose:
print("===== Downloading %s: " % source_candidate, end=" ")
Toolbox.download_to_file(source_candidate, filename)
Toolbox.unzip(filename, destination, trim_directory=1, verbose=verbose)
return
error = (
"Cannot satisfy git dependency for module %s: None of the sources are available."
% module
)
if not git_available:
print(error)
error = "A git installation has not been found."
raise Exception(error)
"""Download and install Miniconda3"""
os_names = {"Darwin": "MacOSX", "Linux": "Linux", "Windows": "Windows"}
filename = "Miniconda3-latest-{platform}-x86_64".format(
platform=os_names[self.system]
)
if self.system == "Windows":
filename += ".exe"
else:
filename += ".sh"
url_base = "https://repo.anaconda.com/miniconda/"
url = url_base + filename
filename = os.path.join(location, filename)
print("Downloading {url}:".format(url=url), end=" ")
result = Toolbox.download_to_file(url, filename)
if result in (0, -1):
sys.exit("Miniconda download failed")
# run the installer
if self.system == "Windows":
command = [
filename,
"/InstallationType=JustMe",
"/RegisterPython=0",
"/AddToPath=0",
"/S",
"/D=" + location,
]
else:
command = ["/bin/sh", filename, "-b", "-u", "-p", location]