def install_docker(self): self.add_apt_key('https://download.docker.com/linux/ubuntu/gpg') self.add_apt_repo('docker', [ 'deb [arch=amd64] https://download.docker.com/linux/ubuntu %s stable' % distro.lsb_release_info()['codename'] ]) self.update_os_repo() self.install_application('docker-ce') self.setup_docker()
def _install_telegraf(self): self.app.log.info('Installing telegraf for metrics reporting') lsb = distro.lsb_release_info() if lsb['distributor_id'].lower() == 'ubuntu': self.app.utils.binary_exec('sudo', 'apt-key', 'adv', '--fetch-keys', 'https://repos.influxdata.com/influxdb.key') with open('/tmp/influxdb.list', 'w+') as influxdb_list: influxdb_list.write(f"deb https://repos.influxdata.com/{lsb['distributor_id'].lower()} {lsb['codename']} stable") self.app.utils.binary_exec('sudo', 'mv', '/tmp/influxdb.list', '/etc/apt/sources.list.d/influxdb.list') self.app.utils.binary_exec('sudo', 'apt-get', 'update') self.app.utils.binary_exec('sudo', 'apt-get', 'install', '-y', 'telegraf') self.app.utils.binary_exec('sudo', 'systemctl', 'enable', 'telegraf') else: # print warning and link to telegraf install self.app.log.warning(f'Automated telegraf installation not supported for {lsb["distributor_id"]}. ' f'Please see manual installation instructions: ' f'https://docs.influxdata.com/telegraf/v1.10/introduction/installation/')
from __future__ import print_function from pprint import pformat import distro def pprint(obj): for line in pformat(obj).split("\n"): print(4 * " " + line) print("os_release_info:") pprint(distro.os_release_info()) print("lsb_release_info:") pprint(distro.lsb_release_info()) print("distro_release_info:") pprint(distro.distro_release_info()) print("id: {0}".format(distro.id())) print("name: {0}".format(distro.name())) print("name_pretty: {0}".format(distro.name(True))) print("version: {0}".format(distro.version())) print("version_pretty: {0}".format(distro.version(True))) print("like: {0}".format(distro.like())) print("codename: {0}".format(distro.codename())) print("linux_distribution_full: {0}".format(distro.linux_distribution())) print("linux_distribution: {0}".format(distro.linux_distribution(False))) print("major_version: {0}".format(distro.major_version())) print("minor_version: {0}".format(distro.minor_version())) print("build_number: {0}".format(distro.build_number()))
def install_keepassxc(self): self.add_apt_repo('keepassxc', [ 'deb http://ppa.launchpad.net/phoerious/keepassxc/ubuntu %s main' % distro.lsb_release_info()['codename'] ]) self.install_application('keepassxc')
# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import distro print 'os_release_info: {0}'.format(distro.os_release_info()) print 'lsb_release_info: {0}'.format(distro.lsb_release_info()) print 'distro_release_info: {0}'.format(distro.distro_release_info()) print 'id: {0}'.format(distro.id()) print 'name: {0}'.format(distro.name()) print 'name_pretty: {0}'.format(distro.name(True)) print 'version: {0}'.format(distro.version()) print 'version_pretty: {0}'.format(distro.version(True)) print 'like: {0}'.format(distro.like()) print 'codename: {0}'.format(distro.codename()) print 'linux_distribution_full: {0}'.format(distro.linux_distribution()) print 'linux_distribution: {0}'.format(distro.linux_distribution(False)) print 'major_version: {0}'.format(distro.major_version()) print 'minor_version: {0}'.format(distro.minor_version()) print 'build_number: {0}'.format(distro.build_number())
def version(): # return platform.version() version = distro.lsb_release_info( )['description'] + "-" + distro.lsb_release_info()["release"] return version
# limitations under the License. from __future__ import print_function import distro from pprint import pformat def pprint(obj): for line in pformat(obj).split('\n'): print(4 * ' ' + line) print('os_release_info:') pprint(distro.os_release_info()) print('lsb_release_info:') pprint(distro.lsb_release_info()) print('distro_release_info:') pprint(distro.distro_release_info()) print('id: {0}'.format(distro.id())) print('name: {0}'.format(distro.name())) print('name_pretty: {0}'.format(distro.name(True))) print('version: {0}'.format(distro.version())) print('version_pretty: {0}'.format(distro.version(True))) print('like: {0}'.format(distro.like())) print('codename: {0}'.format(distro.codename())) print('linux_distribution_full: {0}'.format(distro.linux_distribution())) print('linux_distribution: {0}'.format(distro.linux_distribution(False))) print('major_version: {0}'.format(distro.major_version())) print('minor_version: {0}'.format(distro.minor_version())) print('build_number: {0}'.format(distro.build_number()))