Skip to content

Commit

Permalink
Fix for dependencies to be downloaded (hitachienergy#544)
Browse files Browse the repository at this point in the history
* uniq -> 'sort --unique'

* Updated package dependencies

* Remove trailing spaces

* java-1.8.0-openjdk -> java-1.8.0-openjdk-headless
  • Loading branch information
to-bar authored Oct 2, 2019
1 parent b465281 commit 34522ea
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
- name: Install Elasticsearch package
yum:
name:
- java-1.8.0-openjdk
- java-1.8.0-openjdk-headless
- elasticsearch-oss
update_cache: yes
state: present
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

- name: Install Java package
package:
name: "java-1.8.0-openjdk"
name: "java-1.8.0-openjdk-headless"
state: present
when: ansible_os_family == "RedHat"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ get_package_dependencies() {
local package="$2"

local query_output=$(repoquery --requires --resolve --all --queryformat '%{ui_nevra}' --archlist=x86_64,noarch "$package" 2>&1) ||
exit_with_error "repoquery failed for dependencies of package: $package"
exit_with_error "repoquery failed for dependencies of package: $package with exit code: $?, output was: $query_output"

if [[ -z $query_output ]]; then
echol "No dependencies found for package: $package"
Expand All @@ -150,7 +150,7 @@ get_package_with_version() {
local package="$2"

local query_output=$(repoquery --all --queryformat '%{ui_nevra}' --archlist=x86_64,noarch "$package" 2>&1) ||
exit_with_error "repoquery failed for package: $package"
exit_with_error "repoquery failed for package: $package with exit code: $?, output was: $query_output"

# yumdownloader doesn't handle error codes properly if repoquery gets empty output
[[ -n $query_output ]] || exit_with_error "repoquery failed: package $package not found"
Expand All @@ -169,7 +169,7 @@ get_requirements_from_group() {
local group_name="$2"
local requirements_file_path="$3"

local all_requirements=$(grep --only-matching '^[^#]*' "$requirements_file_path")
local all_requirements=$(grep --only-matching '^[^#]*' "$requirements_file_path" | sed -e 's/[[:space:]]*$//')
local requirements_from_group=$(awk "/^$/ {next}; /\[${group_name}\]/ {f=1; next}; /^\[/ {f=0}; f {print \$0}" <<< "$all_requirements") ||
exit_with_error "Function get_requirements_from_group failed for group: $group_name"

Expand Down Expand Up @@ -232,7 +232,7 @@ remove_added_repos() {
local added_repos_list_file="$1"

if [ -f "$added_repos_list_file" ]; then
for repo_config_file in $(cat $added_repos_list_file | uniq); do
for repo_config_file in $(cat $added_repos_list_file | sort --unique); do
remove_file "/etc/yum.repos.d/$repo_config_file"
done
remove_file "$added_repos_list_file"
Expand All @@ -252,7 +252,7 @@ remove_installed_packages() {
local installed_packages_list_file="$1"

if [ -f "$installed_packages_list_file" ]; then
for package in $(cat $installed_packages_list_file | uniq); do
for package in $(cat $installed_packages_list_file | sort --unique); do
remove_package "$package"
done
remove_file "$installed_packages_list_file"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,50 +10,62 @@ yum-utils
bash-completion
ca-certificates
cifs-utils
conntrack-tools
conntrack-tools # for kubelet
containerd.io
container-selinux
cri-tools-1.13.0
curl
dejavu-sans-fonts # for grafana
docker-ce-18.09.9
docker-ce-cli-18.09.9
ebtables
elasticsearch-curator-5.5.4
elasticsearch-oss-6.4.0
epel-release
ethtool
erlang-21.3.8.7
ethtool
filebeat-6.5.4 # actually it's filebeat-oss
firewalld
fontconfig # for grafana
fping
grafana-6.2.5
gssproxy # for nfs-utils
htop
iftop
java-1.8.0-openjdk
ipset # for firewalld
java-1.8.0-openjdk-headless
javapackages-tools # for java-1.8.0-openjdk-headless
jq
kibana-oss-6.4.0
kubeadm-1.14.6
kubectl-1.14.6
kubelet-1.14.6
kubernetes-cni-0.7.5
libnetfilter_cthelper
libnetfilter_cttimeout
libnetfilter_queue
libini_config # for nfs-utils
libselinux-python
libsemanage-python
libX11 # for grafana
libxcb # for grafana
libXcursor # for grafana
libXt # for grafana
logrotate
nmap-ncat
net-tools
nfs-utils
nmap-ncat
openssl
perl # for vim
perl-Getopt-Long # for vim
perl-libs # for vim
perl-Pod-Perldoc # for vim
perl-Pod-Simple # for vim
perl-Pod-Usage # for vim
policycoreutils-python # for container-selinux
python-firewall # for firewalld
python-kitchen # for yum-utils
python-lxml # for java-1.8.0-openjdk-headless
python-psycopg2
python-setuptools
quota # for nfs-utils
rabbitmq-server-3.7.10
rh-haproxy18
rh-haproxy18-haproxy-syspaths
Expand All @@ -65,14 +77,18 @@ rh-postgresql10-postgresql-server
rh-postgresql10-postgresql-server-syspaths
rh-postgresql10-postgresql-syspaths
samba-client
samba-client-libs # for samba-client
samba-common
socat
sysstat
tar
telnet
tmux
urw-base35-fonts # for grafana
vim-common # for vim
vim-enhanced
xorg-x11-font-utils # for grafana
xorg-x11-server-utils # for grafana
yum-plugin-versionlock

[files]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ get_package_dependencies() {
local package="$2"

local query_output=$(repoquery --requires --resolve --all --queryformat '%{ui_nevra}' --archlist=x86_64,noarch "$package" 2>&1) ||
exit_with_error "repoquery failed for dependencies of package: $package"
exit_with_error "repoquery failed for dependencies of package: $package with exit code: $?, output was: $query_output"

if [[ -z $query_output ]]; then
echol "No dependencies found for package: $package"
Expand All @@ -167,7 +167,7 @@ get_package_with_version() {
local package="$2"

local query_output=$(repoquery --all --queryformat '%{ui_nevra}' --archlist=x86_64,noarch "$package" 2>&1) ||
exit_with_error "repoquery failed for package: $package"
exit_with_error "repoquery failed for package: $package with exit code: $?, output was: $query_output"

# yumdownloader doesn't handle error codes properly if repoquery gets empty output
[[ -n $query_output ]] || exit_with_error "repoquery failed: package $package not found"
Expand All @@ -186,7 +186,7 @@ get_requirements_from_group() {
local group_name="$2"
local requirements_file_path="$3"

local all_requirements=$(grep --only-matching '^[^#]*' "$requirements_file_path")
local all_requirements=$(grep --only-matching '^[^#]*' "$requirements_file_path" | sed -e 's/[[:space:]]*$//')
local requirements_from_group=$(awk "/^$/ {next}; /\[${group_name}\]/ {f=1; next}; /^\[/ {f=0}; f {print \$0}" <<< "$all_requirements") ||
exit_with_error "Function get_requirements_from_group failed for group: $group_name"

Expand Down Expand Up @@ -249,7 +249,7 @@ remove_added_repos() {
local added_repos_list_file="$1"

if [ -f "$added_repos_list_file" ]; then
for repo_config_file in $(cat $added_repos_list_file | uniq); do
for repo_config_file in $(cat $added_repos_list_file | sort --unique); do
remove_file "/etc/yum.repos.d/$repo_config_file"
done
remove_file "$added_repos_list_file"
Expand All @@ -269,7 +269,7 @@ remove_installed_packages() {
local installed_packages_list_file="$1"

if [ -f "$installed_packages_list_file" ]; then
for package in $(cat $installed_packages_list_file | uniq); do
for package in $(cat $installed_packages_list_file | sort --unique); do
remove_package "$package"
done
remove_file "$installed_packages_list_file"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,50 +10,62 @@ yum-utils
bash-completion
ca-certificates
cifs-utils
conntrack-tools
conntrack-tools # for kubelet
containerd.io
container-selinux
cri-tools-1.13.0
curl
dejavu-sans-fonts # for grafana
docker-ce-18.09.9
docker-ce-cli-18.09.9
ebtables
elasticsearch-curator-5.5.4
elasticsearch-oss-6.4.0
epel-release
ethtool
erlang-21.3.8.7
ethtool
filebeat-6.5.4 # actually it's filebeat-oss
firewalld
fontconfig # for grafana
fping
grafana-6.2.5
gssproxy # for nfs-utils
htop
iftop
java-1.8.0-openjdk
ipset # for firewalld
java-1.8.0-openjdk-headless
javapackages-tools # for java-1.8.0-openjdk-headless
jq
kibana-oss-6.4.0
kubeadm-1.14.6
kubectl-1.14.6
kubelet-1.14.6
kubernetes-cni-0.7.5
libnetfilter_cthelper
libnetfilter_cttimeout
libnetfilter_queue
libini_config # for nfs-utils
libselinux-python
libsemanage-python
libX11 # for grafana
libxcb # for grafana
libXcursor # for grafana
libXt # for grafana
logrotate
nmap-ncat
net-tools
nfs-utils
nmap-ncat
openssl
perl # for vim
perl-Getopt-Long # for vim
perl-libs # for vim
perl-Pod-Perldoc # for vim
perl-Pod-Simple # for vim
perl-Pod-Usage # for vim
policycoreutils-python # for container-selinux
python-firewall # for firewalld
python-kitchen # for yum-utils
python-lxml # for java-1.8.0-openjdk-headless
python-psycopg2
python-setuptools
quota # for nfs-utils
rabbitmq-server-3.7.10
rh-haproxy18
rh-haproxy18-haproxy-syspaths
Expand All @@ -65,14 +77,18 @@ rh-postgresql10-postgresql-server
rh-postgresql10-postgresql-server-syspaths
rh-postgresql10-postgresql-syspaths
samba-client
samba-client-libs # for samba-client
samba-common
socat
sysstat
tar
telnet
tmux
urw-base35-fonts # for grafana
vim-common # for vim
vim-enhanced
xorg-x11-font-utils # for grafana
xorg-x11-server-utils # for grafana
yum-plugin-versionlock

[files]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

- name: Install Java package
package:
name: "java-1.8.0-openjdk"
name: "java-1.8.0-openjdk-headless"
state: present
when: ansible_os_family == "RedHat"

Expand Down

0 comments on commit 34522ea

Please sign in to comment.