Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package google-guest-agent for openSUSE:Factory checked in at 2025-01-21 21:10:22 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/google-guest-agent (Old) and /work/SRC/openSUSE:Factory/.google-guest-agent.new.5589 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "google-guest-agent" Tue Jan 21 21:10:22 2025 rev:40 rq:1239111 version:20241209.01 Changes: -------- --- /work/SRC/openSUSE:Factory/google-guest-agent/google-guest-agent.changes 2024-10-23 21:10:36.083499192 +0200 +++ /work/SRC/openSUSE:Factory/.google-guest-agent.new.5589/google-guest-agent.changes 2025-01-21 21:10:46.999741490 +0100 @@ -1,0 +2,19 @@ +Mon Jan 13 19:33:18 UTC 2025 - rjsch...@suse.com + +- Update to version 20241209.01: (bsc#1235664) + * readme: add notes about plugin manager (#476) + * Update metadata script runner to honor cloud logging config flag (#475) + * Fixing fallback from systemd-networkd to dhclient (#471) + * network: fix nmcli check pattern (#472) + * Update readme with guest agent manager (#469) + * Add missing packaging spec (#466) + * Bring back side-by-side packaging (#464) + * Avoid changing permissions of directory if parent is / (#463) + * network: force NetworkManager to connect to primary nic (#461) + * Revert plugin manager packaging (#460) + * Add GOPATH to PATH in debian build (#459) + * Add plugin manager to debian build (#457) + * rpm packaging: fix plugin manager assumptions (#458) + * packaging: add plugin manager to rhel packaging (#454) + +------------------------------------------------------------------- Old: ---- guest-agent-20241018.01.tar.gz New: ---- guest-agent-20241209.01.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ google-guest-agent.spec ++++++ --- /var/tmp/diff_new_pack.NjtplW/_old 2025-01-21 21:10:47.727771541 +0100 +++ /var/tmp/diff_new_pack.NjtplW/_new 2025-01-21 21:10:47.731771706 +0100 @@ -1,7 +1,7 @@ # # spec file for package google-guest-agent # -# Copyright (c) 2024 SUSE LLC +# Copyright (c) 2025 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -24,7 +24,7 @@ %global import_path %{provider_prefix} Name: google-guest-agent -Version: 20241018.01 +Version: 20241209.01 Release: 0 Summary: Google Cloud Guest Agent License: Apache-2.0 ++++++ _service ++++++ --- /var/tmp/diff_new_pack.NjtplW/_old 2025-01-21 21:10:47.763773028 +0100 +++ /var/tmp/diff_new_pack.NjtplW/_new 2025-01-21 21:10:47.767773193 +0100 @@ -3,8 +3,8 @@ <param name="url">https://github.com/GoogleCloudPlatform/guest-agent/</param> <param name="scm">git</param> <param name="exclude">.git</param> - <param name="versionformat">20241018.01</param> - <param name="revision">20241018.01</param> + <param name="versionformat">20241209.01</param> + <param name="revision">20241209.01</param> <param name="changesgenerate">enable</param> </service> <service name="recompress" mode="disabled"> @@ -15,7 +15,7 @@ <param name="basename">guest-agent</param> </service> <service name="go_modules" mode="disabled"> - <param name="archive">guest-agent-20241018.01.tar.gz</param> + <param name="archive">guest-agent-20241209.01.tar.gz</param> </service> </services> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.NjtplW/_old 2025-01-21 21:10:47.787774018 +0100 +++ /var/tmp/diff_new_pack.NjtplW/_new 2025-01-21 21:10:47.791774184 +0100 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/GoogleCloudPlatform/guest-agent/</param> - <param name="changesrevision">b57b78084040636ecffb1ec2a351e1f192e43768</param></service></servicedata> + <param name="changesrevision">2ef2fb65159aca55c786e7bfd86648dc6ab63033</param></service></servicedata> (No newline at EOF) ++++++ guest-agent-20241018.01.tar.gz -> guest-agent-20241209.01.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guest-agent-20241018.01/README.md new/guest-agent-20241209.01/README.md --- old/guest-agent-20241018.01/README.md 2024-10-18 21:45:25.000000000 +0200 +++ new/guest-agent-20241209.01/README.md 2024-12-10 00:23:04.000000000 +0100 @@ -29,6 +29,13 @@ * **google-metadata-script-runner** binary to run user-provided scripts at VM startup and shutdown. +Note: Starting in December 2024 guest agent installs a secondary systemd unit +named google-guest-agent-manager, this unit manages on demand plugins lifecycle, +such plugin architecture will support expansion of the guest agent in the future. +In the upcoming releases both google-guest-agent and google-guest-agent-manager +will be consolidated in a single unit. The source code for plugin manager can +be found [here](https://github.com/GoogleCloudPlatform/google-guest-agent). + ## Features The guest agent functionality can be separated into various areas of @@ -365,7 +372,12 @@ google-compute-engine-windows - contains the guest agent executable. google-compute-engine-metadata-scripts - contains files to run startup and shutdown scripts. +google-compute-engine-windows contains `GCEAgent` and `GCEAgentManager` windows services. + We build the following packages for the Linux guest environment: -google-guest-agent - contains the guest agent and metadata script runner -executables, as well as service files for both. +google-guest-agent - contains the guest agent, google-guest-agent-manager and metadata script runner +executables, as well as service files for all. + +Refer [this](https://github.com/GoogleCloudPlatform/google-guest-agent) repo for further details on +Google Guest Agent Manager. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guest-agent-20241018.01/google_guest_agent/command/command_linux.go new/guest-agent-20241209.01/google_guest_agent/command/command_linux.go --- old/guest-agent-20241018.01/google_guest_agent/command/command_linux.go 2024-10-18 21:45:25.000000000 +0200 +++ new/guest-agent-20241209.01/google_guest_agent/command/command_linux.go 2024-12-10 00:23:04.000000000 +0100 @@ -32,32 +32,34 @@ const DefaultPipePath = "/run/google-guest-agent/commands.sock" func mkdirpWithPerms(dir string, p os.FileMode, uid, gid int) error { + parent := path.Dir(dir) stat, err := os.Stat(dir) if err == nil { - statT, ok := stat.Sys().(*syscall.Stat_t) - if !ok { - return fmt.Errorf("could not determine owner of %s", dir) - } - if !stat.IsDir() { - return fmt.Errorf("%s exists and is not a directory", dir) - } - if morePermissive(int(stat.Mode()), int(p)) { - if err := os.Chmod(dir, p); err != nil { - return fmt.Errorf("could not correct %s permissions to %d: %v", dir, p, err) + if parent != "/" && parent != "" { + statT, ok := stat.Sys().(*syscall.Stat_t) + if !ok { + return fmt.Errorf("could not determine owner of %s", dir) } - } - if statT.Uid != 0 && statT.Uid != uint32(uid) { - if err := os.Chown(dir, uid, -1); err != nil { - return fmt.Errorf("could not correct %s owner to %d: %v", dir, uid, err) + if !stat.IsDir() { + return fmt.Errorf("%s exists and is not a directory", dir) } - } - if statT.Gid != 0 && statT.Gid != uint32(gid) { - if err := os.Chown(dir, -1, gid); err != nil { - return fmt.Errorf("could not correct %s group to %d: %v", dir, gid, err) + if morePermissive(int(stat.Mode()), int(p)) { + if err := os.Chmod(dir, p); err != nil { + return fmt.Errorf("could not correct %s permissions to %d: %v", dir, p, err) + } + } + if statT.Uid != 0 && statT.Uid != uint32(uid) { + if err := os.Chown(dir, uid, -1); err != nil { + return fmt.Errorf("could not correct %s owner to %d: %v", dir, uid, err) + } + } + if statT.Gid != 0 && statT.Gid != uint32(gid) { + if err := os.Chown(dir, -1, gid); err != nil { + return fmt.Errorf("could not correct %s group to %d: %v", dir, gid, err) + } } } } else { - parent := path.Dir(dir) if parent != "/" && parent != "" { if err := mkdirpWithPerms(parent, p, uid, gid); err != nil { return err diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guest-agent-20241018.01/google_guest_agent/network/manager/network_manager_linux.go new/guest-agent-20241209.01/google_guest_agent/network/manager/network_manager_linux.go --- old/guest-agent-20241018.01/google_guest_agent/network/manager/network_manager_linux.go 2024-10-18 21:45:25.000000000 +0200 +++ new/guest-agent-20241209.01/google_guest_agent/network/manager/network_manager_linux.go 2024-12-10 00:23:04.000000000 +0100 @@ -143,8 +143,8 @@ // Check for existence of nmcli. Without nmcli, the agent cannot tell NetworkManager // to reload the configs for its connections. - _, err := cliExists("nmcli") - if err != nil { + exists, err := cliExists("nmcli") + if !exists { return false, err } @@ -350,16 +350,22 @@ return fmt.Errorf("getting interfaces: %v", err) } - for _, iface := range ifaces { - if err := n.removeInterface(iface); err != nil { + reconnectPrimaryNic := false + + for i, iface := range ifaces { + removed, err := n.removeInterface(iface) + if err != nil { logger.Errorf("Failed to remove %q interface with error: %v", iface, err) } + if i == 0 && removed { + reconnectPrimaryNic = true + } } if removeVlan { for _, vnic := range nics.VlanInterfaces { iface := n.vlanInterfaceName(vnic.ParentInterfaceID, vnic.Vlan) - if err := n.removeInterface(iface); err != nil { + if _, err := n.removeInterface(iface); err != nil { logger.Errorf("Failed to remove %q interface with error: %v", iface, err) } } @@ -369,6 +375,15 @@ return fmt.Errorf("error reloading NetworkManager config cache: %v", err) } + // NetworkManager will not create a default connection if we are removing the one + // we manage, in that case we need to force it to connect and then with that create + // a default connection. + if reconnectPrimaryNic { + if err := run.Quiet(ctx, "nmcli", "device", "connect", ifaces[0]); err != nil { + return fmt.Errorf("error connecting NetworkManager's managed interface: %s, %v", ifaces[0], err) + } + } + return nil } @@ -385,29 +400,30 @@ } // removeInterface verifies .nmconnection is managed by Guest Agent and removes it. -func (n *networkManager) removeInterface(iface string) error { +// It returns true if the configuration removal succeeds and false otherwise. +func (n *networkManager) removeInterface(iface string) (bool, error) { configFilePath := n.networkManagerConfigFilePath(iface) _, err := os.Stat(configFilePath) if err != nil { if !os.IsNotExist(err) { - return fmt.Errorf("unable to remove %q interface, stat failed on %q: %w", iface, configFilePath, err) + return false, fmt.Errorf("unable to remove %q interface, stat failed on %q: %w", iface, configFilePath, err) } logger.Debugf("NetworkManager's configuration file %q doesn't exist, ignoring.", configFilePath) - return nil + return false, nil } config := new(nmConfig) if err := readIniFile(configFilePath, config); err != nil { - return fmt.Errorf("failed to load NetworkManager %q file: %v", configFilePath, err) + return false, fmt.Errorf("failed to load NetworkManager %q file: %v", configFilePath, err) } if config.GuestAgent.ManagedByGuestAgent { logger.Debugf("Attempting to remove NetworkManager configuration %s", configFilePath) if err = os.Remove(configFilePath); err != nil { - return fmt.Errorf("error deleting config file for %s: %v", iface, err) + return false, fmt.Errorf("error deleting config file for %s: %v", iface, err) } } - return nil + return true, nil } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guest-agent-20241018.01/google_guest_agent/network/manager/systemd_networkd_linux.go new/guest-agent-20241209.01/google_guest_agent/network/manager/systemd_networkd_linux.go --- old/guest-agent-20241018.01/google_guest_agent/network/manager/systemd_networkd_linux.go 2024-10-18 21:45:25.000000000 +0200 +++ new/guest-agent-20241209.01/google_guest_agent/network/manager/systemd_networkd_linux.go 2024-12-10 00:23:04.000000000 +0100 @@ -186,8 +186,8 @@ // to check if systemd-networkd is managing or has configured the provided interface. func (n *systemdNetworkd) IsManaging(ctx context.Context, iface string) (bool, error) { // Check the version. - _, err := cliExists("networkctl") - if err != nil { + exists, err := cliExists("networkctl") + if !exists { return false, err } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guest-agent-20241018.01/google_metadata_script_runner/main.go new/guest-agent-20241209.01/google_metadata_script_runner/main.go --- old/guest-agent-20241018.01/google_metadata_script_runner/main.go 2024-10-18 21:45:25.000000000 +0200 +++ new/guest-agent-20241209.01/google_metadata_script_runner/main.go 2024-12-10 00:23:04.000000000 +0100 @@ -162,9 +162,7 @@ return nil } - if err != nil { - logger.Infof("Failed to download object [%s] from GCS bucket [%s], err: %+v", object, bucket, err) - } + logger.Infof("Failed to download object [%s] from GCS bucket [%s], err: %+v", object, bucket, err) logger.Infof("Trying unauthenticated download") path = fmt.Sprintf("https://%s/%s/%s", storageURL, bucket, object) @@ -439,6 +437,10 @@ os.Exit(1) } + if !cfg.Get().Core.CloudLoggingEnabled { + opts.DisableCloudLogging = true + } + // The keys to check vary based on the argument and the OS. Also functions to validate arguments. wantedKeys, err := getWantedKeys(os.Args, runtime.GOOS) if err != nil { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guest-agent-20241018.01/packaging/debian/rules new/guest-agent-20241209.01/packaging/debian/rules --- old/guest-agent-20241018.01/packaging/debian/rules 2024-10-18 21:45:25.000000000 +0200 +++ new/guest-agent-20241209.01/packaging/debian/rules 2024-12-10 00:23:04.000000000 +0100 @@ -1,6 +1,6 @@ #!/usr/bin/make -f -export PATH := /tmp/go/bin:$(PATH) +export PATH := /tmp/go/bin:/usr/share/gocode/bin:$(HOME)/.local/bin:$(PATH) export SHELL := env PATH=$(PATH) /bin/bash export DH_OPTIONS @@ -22,12 +22,18 @@ install -p -m 0644 instance_configs.cfg debian/google-guest-agent/usr/share/google-guest-agent install -d debian/google-guest-agent/lib/systemd/system install -p -m 0644 gce-workload-cert-refresh.timer debian/google-guest-agent/lib/systemd/system/ + if [[ -d google-guest-agent ]]; then\ + install -p -m 0644 google-guest-agent/cmd/google_guest_agent/google_guest_agent debian/google-guest-agent/usr/bin/google_guest_agent_manager;\ + fi override_dh_golang: # We don't use any packaged dependencies, so skip dh_golang step. override_dh_auto_build: dh_auto_build -O--buildsystem=golang -- -ldflags="-s -w -X main.version=$(VERSION)" -mod=readonly + if [[ -d google-guest-agent ]]; then\ + VERSION=$(VERSION) make -C google-guest-agent cmd/google_guest_agent/google_guest_agent;\ + fi override_dh_installinit: # We don't ship sysvinit files or need script changes for them. @@ -35,11 +41,21 @@ override_dh_systemd_enable: install -d debian/google-guest-agent/lib/systemd/system install -p -m 0644 *.service debian/google-guest-agent/lib/systemd/system/ + # Don't include guest agent manager if not building with it. + if [[ ! -d google-guest-agent ]]; then\ + rm -f debian/google-guest-agent/lib/systemd/systemd/google-guest-agent-manager.service;\ + fi install -d debian/google-guest-agent/lib/systemd/system-preset install -p -m 0644 *.preset debian/google-guest-agent/lib/systemd/system-preset/ dh_systemd_enable google-guest-agent.service google-startup-scripts.service google-shutdown-scripts.service gce-workload-cert-refresh.timer + if [[ -d google-guest-agent ]]; then\ + dh_systemd_enable google-guest-agent-manager.service;\ + fi override_dh_systemd_start: # Only perform start/stop actions for the guest agent and cert refresh timer. dh_systemd_start google-guest-agent.service dh_systemd_start gce-workload-cert-refresh.timer + if [[ -d google-guest-agent ]]; then\ + dh_systemd_start google-guest-agent-manager.service;\ + fi diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guest-agent-20241018.01/packaging/googet/agent_install.ps1 new/guest-agent-20241209.01/packaging/googet/agent_install.ps1 --- old/guest-agent-20241018.01/packaging/googet/agent_install.ps1 2024-10-18 21:45:25.000000000 +0200 +++ new/guest-agent-20241209.01/packaging/googet/agent_install.ps1 2024-12-10 00:23:04.000000000 +0100 @@ -51,8 +51,7 @@ -BinaryPathName $service_binary ` -StartupType Automatic ` -Description $service_desc - } - else { + } else { Set-Service -Name $service_name ` -DisplayName $service_display_name ` -Description $service_desc @@ -77,6 +76,11 @@ if ($install_manager) { Set-New-Service $manager_name $manager_display_name $manager_description $manager_path Set-ServiceConfig $manager_name $manager_path + } else { + if (Get-Service $manager_name -ErrorAction SilentlyContinue) { + Stop-Service $manager_name + & sc.exe delete $manager_name + } } $config = "${env:ProgramFiles}\Google\Compute Engine\instance_configs.cfg" @@ -94,4 +98,4 @@ Write-Output $_.InvocationInfo.PositionMessage Write-Output "Install failed: $($_.Exception.Message)" exit 1 -} \ No newline at end of file +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guest-agent-20241018.01/packaging/googet/agent_uninstall.ps1 new/guest-agent-20241209.01/packaging/googet/agent_uninstall.ps1 --- old/guest-agent-20241018.01/packaging/googet/agent_uninstall.ps1 2024-10-18 21:45:25.000000000 +0200 +++ new/guest-agent-20241209.01/packaging/googet/agent_uninstall.ps1 2024-12-10 00:23:04.000000000 +0100 @@ -19,4 +19,5 @@ if (Get-Service $name -ErrorAction SilentlyContinue) { Stop-Service $name -Verbose & sc.exe delete $name -} \ No newline at end of file +} + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guest-agent-20241018.01/packaging/googet/windows_agent_build.sh new/guest-agent-20241209.01/packaging/googet/windows_agent_build.sh --- old/guest-agent-20241018.01/packaging/googet/windows_agent_build.sh 2024-10-18 21:45:25.000000000 +0200 +++ new/guest-agent-20241209.01/packaging/googet/windows_agent_build.sh 2024-12-10 00:23:04.000000000 +0100 @@ -23,6 +23,7 @@ GOOS=windows /tmp/go/bin/go build -ldflags "-X main.version=$version" -mod=readonly -o GCEWindowsAgent.exe ./google_guest_agent GOOS=windows /tmp/go/bin/go build -ldflags "-X main.version=$version" -mod=readonly -o GCEAuthorizedKeysCommand.exe ./google_authorized_keys + # Script expects guest-agent and google-guest-agent codebase are placed # side-by-side within same directory and this script is executed from root of # guest-agent codebase. @@ -39,4 +40,4 @@ pushd $GUEST_AGENT_REPO GOOS=windows VERSION=$version make cmd/google_guest_agent/google_guest_agent cp cmd/google_guest_agent/google_guest_agent.exe $BUILD_DIR/GCEWindowsAgentManager.exe -popd +popd \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guest-agent-20241018.01/packaging/google-guest-agent.spec new/guest-agent-20241209.01/packaging/google-guest-agent.spec --- old/guest-agent-20241018.01/packaging/google-guest-agent.spec 2024-10-18 21:45:25.000000000 +0200 +++ new/guest-agent-20241209.01/packaging/google-guest-agent.spec 2024-12-10 00:23:04.000000000 +0100 @@ -15,6 +15,11 @@ # Don't build debuginfo packages. %define debug_package %{nil} +# The only use for extra source is to build plugin manager. +%if 0%{?has_extra_source} +%define build_plugin_manager %{has_extra_source} +%endif + Name: google-guest-agent Epoch: 1 Version: %{_version} @@ -23,6 +28,11 @@ License: ASL 2.0 Url: https://cloud.google.com/compute/docs/images/guest-environment Source0: %{name}_%{version}.orig.tar.gz + +%if 0%{?build_plugin_manager} +Source1: %{name}_extra-%{version}.orig.tar.gz +%endif + Requires: google-compute-engine-oslogin >= 1:20231003 BuildArch: %{_arch} @@ -36,7 +46,12 @@ Contains the Google guest agent binary. %prep + +%if 0%{?build_plugin_manager} +%autosetup -a 1 +%else %autosetup +%endif %build for bin in google_guest_agent google_metadata_script_runner gce_workload_cert_refresh; do @@ -44,6 +59,12 @@ GOPATH=%{_gopath} CGO_ENABLED=0 %{_go} build -ldflags="-s -w -X main.version=%{_version}" -mod=readonly popd done +# Build side-by-side both new agent (plugin manager) and legacy agent. +%if 0%{?build_plugin_manager} +pushd %{name}-extra-%{version}/ + VERSION=%{version} make cmd/google_guest_agent/google_guest_agent +popd +%endif %install install -d "%{buildroot}/%{_docdir}/%{name}" @@ -55,6 +76,12 @@ install -p -m 0755 gce_workload_cert_refresh/gce_workload_cert_refresh %{buildroot}%{_bindir}/gce_workload_cert_refresh install -d %{buildroot}/usr/share/google-guest-agent install -p -m 0644 instance_configs.cfg %{buildroot}/usr/share/google-guest-agent/instance_configs.cfg + +# Compat agent, it will become google_guest_agent after the full package transition. +%if 0%{?build_plugin_manager} +install -p -m 0755 %{name}-extra-%{version}/cmd/google_guest_agent/google_guest_agent %{buildroot}%{_bindir}/google_guest_agent_manager +%endif + %if 0%{?el6} install -d %{buildroot}/etc/init install -p -m 0644 %{name}.conf %{buildroot}/etc/init/ @@ -64,6 +91,11 @@ install -d %{buildroot}%{_unitdir} install -d %{buildroot}%{_presetdir} install -p -m 0644 %{name}.service %{buildroot}%{_unitdir} + +%if 0%{?build_plugin_manager} +install -p -m 0644 google-guest-agent-manager.service %{buildroot}%{_unitdir} +%endif + install -p -m 0644 google-startup-scripts.service %{buildroot}%{_unitdir} install -p -m 0644 google-shutdown-scripts.service %{buildroot}%{_unitdir} install -p -m 0644 gce-workload-cert-refresh.service %{buildroot}%{_unitdir} @@ -76,6 +108,11 @@ %defattr(-,root,root,-) /usr/share/google-guest-agent/instance_configs.cfg %{_bindir}/google_guest_agent + +%if 0%{?build_plugin_manager} +%{_bindir}/google_guest_agent_manager +%endif + %{_bindir}/google_metadata_script_runner %{_bindir}/gce_workload_cert_refresh %if 0%{?el6} @@ -84,6 +121,11 @@ /etc/init/google-shutdown-scripts.conf %else %{_unitdir}/%{name}.service + +%if 0%{?build_plugin_manager} +%{_unitdir}/google-guest-agent-manager.service +%endif + %{_unitdir}/google-startup-scripts.service %{_unitdir}/google-shutdown-scripts.service %{_unitdir}/gce-workload-cert-refresh.service @@ -108,27 +150,47 @@ systemctl enable google-shutdown-scripts.service >/dev/null 2>&1 || : systemctl enable gce-workload-cert-refresh.timer >/dev/null 2>&1 || : + %if 0%{?build_plugin_manager} + systemctl enable google-guest-agent-manager.service >/dev/null 2>&1 || : + %endif + if [ -d /run/systemd/system ]; then systemctl daemon-reload >/dev/null 2>&1 || : systemctl start google-guest-agent.service >/dev/null 2>&1 || : systemctl start gce-workload-cert-refresh.timer >/dev/null 2>&1 || : + %if 0%{?build_plugin_manager} + systemctl start google-guest-agent-manager.service >/dev/null 2>&1 || : + %endif fi + + else # Package upgrade if [ -d /run/systemd/system ]; then + systemctl daemon-reload >/dev/null 2>&1 || : systemctl try-restart google-guest-agent.service >/dev/null 2>&1 || : + %if 0%{?build_plugin_manager} + systemctl enable google-guest-agent-manager.service >/dev/null 2>&1 || : + systemctl restart google-guest-agent-manager.service >/dev/null 2>&1 || : + %endif fi fi %preun if [ $1 -eq 0 ]; then # Package removal, not upgrade + %if 0%{?build_plugin_manager} + systemctl --no-reload disable google-guest-agent-manager.service >/dev/null 2>&1 || : + %endif systemctl --no-reload disable google-guest-agent.service >/dev/null 2>&1 || : systemctl --no-reload disable google-startup-scripts.service >/dev/null 2>&1 || : systemctl --no-reload disable google-shutdown-scripts.service >/dev/null 2>&1 || : systemctl --no-reload disable gce-workload-cert-refresh.timer >/dev/null 2>&1 || : if [ -d /run/systemd/system ]; then systemctl stop google-guest-agent.service >/dev/null 2>&1 || : + %if 0%{?build_plugin_manager} + systemctl stop google-guest-agent-manager.service >/dev/null 2>&1 || : + %endif fi fi