Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(rpm): Ensure telegraf is installed after useradd #14654

Merged
merged 3 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -368,10 +368,10 @@ $(include_packages):
--after-remove scripts/rpm/post-remove.sh \
--description "Plugin-driven server agent for reporting metrics into InfluxDB." \
--depends coreutils \
--depends shadow-utils \
--rpm-digest sha256 \
--rpm-posttrans scripts/rpm/post-install.sh \
--rpm-os ${GOOS} \
--rpm-tag "Requires(pre): /usr/sbin/useradd" \
--name telegraf \
--version $(version) \
--iteration $(rpm_iteration) \
Expand Down
13 changes: 10 additions & 3 deletions tools/package_incus_test/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func (c *Container) Install(packageName ...string) error {
case "dnf":
cmd = append([]string{"dnf", "install", "-y"}, packageName...)
case "zypper":
cmd = append([]string{"zypper", "install", "-y"}, packageName...)
cmd = append([]string{"zypper", "--gpg-auto-import-keys", "install", "-y"}, packageName...)
}

err := c.client.Exec(c.Name, cmd...)
Expand Down Expand Up @@ -247,7 +247,8 @@ func (c *Container) configureDnf() error {
func (c *Container) configureZypper() error {
err := c.client.Exec(
c.Name,
"echo", fmt.Sprintf("%q", influxDataRPMRepo), ">", "/etc/zypp/repos.d/influxdata.repo",
"bash", "-c", "--",
fmt.Sprintf("echo -e %q > /etc/zypp/repos.d/influxdata.repo", influxDataRPMRepo),
)
if err != nil {
return err
Expand All @@ -259,7 +260,7 @@ func (c *Container) configureZypper() error {
"cat /etc/zypp/repos.d/influxdata.repo",
)

return c.client.Exec(c.Name, "zypper", "refresh")
return c.client.Exec(c.Name, "zypper", "--no-gpg-checks", "refresh")
}

// Determine if the system uses yum or apt for software
Expand All @@ -285,6 +286,12 @@ func (c *Container) detectPackageManager() error {
return nil
}

err = c.client.Exec(c.Name, "which", "zypper")
if err == nil {
c.packageManager = "zypper"
return nil
}

return fmt.Errorf("unable to determine package manager")
}

Expand Down
3 changes: 1 addition & 2 deletions tools/package_incus_test/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ var imagesRPM = []string{
"fedora/39",
"fedora/38",
"centos/9-Stream",
//"opensuse/15.3", // shadow-utils dependency bug see #3833
//"opensuse/tumbleweed", // shadow-utils dependency bug see #3833
"opensuse/tumbleweed",
}

var imagesDEB = []string{
Expand Down
Loading