cmd

package
v1.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 16, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func GetServerVersion added in v1.5.0

func GetServerVersion() string

ServerVersion retrieves the server version from the configured server URL. It uses the resty library to make an HTTP GET request to the "/v1/version" endpoint. If authentication is configured (username and password), it sets the Basic Auth header. On success, it returns the server version string. On failure (including network errors or invalid server response), it returns "unknown".

func LatestAgentVersion added in v1.4.0

func LatestAgentVersion() string

LatestAgentVersion retrieves the latest agent version from a remote server. It checks the 'agent.check_version' configuration to determine if version checking is enabled. If enabled, it makes an HTTP GET request to "https://txlog.rda.run/docs/agent/version". If the request is successful and returns a 200 status code, the function returns the body of the response as a string, which represents the latest agent version. If there is an error during the request or the status code is not 200, or if version checking is disabled, the function returns an empty string.

Types

type Execution added in v1.1.1

type Execution struct {
	ExecutionID           string     `json:"execution_id,omitempty"`
	MachineID             string     `json:"machine_id"`
	Hostname              string     `json:"hostname"`
	ExecutedAt            *time.Time `json:"executed_at"`
	Success               bool       `json:"success"`
	Details               string     `json:"details,omitempty"`
	TransactionsProcessed int        `json:"transactions_processed,omitempty"`
	TransactionsSent      int        `json:"transactions_sent,omitempty"`
	AgentVersion          string     `json:"agent_version,omitempty"`
	OS                    string     `json:"os,omitempty"`
}

type MachineID added in v1.1.1

type MachineID struct {
	Hostname  string     `json:"hostname"`
	MachineID string     `json:"machine_id"`
	BeginTime *time.Time `json:"begin_time"`
}

type Package

type Package struct {
	Action   string `json:"action"`
	Name     string `json:"name"`
	Version  string `json:"version"`
	Release  string `json:"release"`
	Epoch    string `json:"epoch"`
	Arch     string `json:"arch"`
	Repo     string `json:"repo"`
	FromRepo string `json:"from_repo,omitempty"`
}

Package represents a single package in a transaction entry.

type ServerVersion added in v1.1.1

type ServerVersion struct {
	Version string `json:"version"`
}

type Transaction added in v1.1.1

type Transaction struct {
	TransactionID   string            `json:"transaction_id"`
	MachineID       string            `json:"machine_id,omitempty"`
	Hostname        string            `json:"hostname"`
	BeginTime       *time.Time        `json:"begin_time"`
	EndTime         *time.Time        `json:"end_time"`
	Actions         string            `json:"actions"`
	Altered         string            `json:"altered"`
	User            string            `json:"user"`
	ReturnCode      string            `json:"return_code"`
	ReleaseVersion  string            `json:"release_version"`
	CommandLine     string            `json:"command_line"`
	Comment         string            `json:"comment"`
	ScriptletOutput string            `json:"scriptlet_output"`
	Items           []TransactionItem `json:"items"`
}

type TransactionDetail

type TransactionDetail struct {
	TransactionID   string    `json:"transaction_id"`
	BeginTime       string    `json:"begin_time"`
	BeginRPMDB      string    `json:"begin_rpmdb"`
	EndTime         string    `json:"end_time"`
	EndRPMDB        string    `json:"end_rpmdb"`
	User            string    `json:"user"`
	ReturnCode      string    `json:"return_code"`
	Releasever      string    `json:"releasever"`
	CommandLine     string    `json:"command_line"`
	Comment         string    `json:"comment"`
	PackagesAltered []Package `json:"packages_altered"`
	ScriptletOutput []string  `json:"scriptlet_output"`
}

TransactionDetail represents a detailed transaction entry, as shown in the 'dnf history info' command.

type TransactionItem added in v1.1.1

type TransactionItem struct {
	Action   string `json:"action"`
	Name     string `json:"name"`
	Version  string `json:"version"`
	Release  string `json:"release"`
	Epoch    string `json:"epoch"`
	Arch     string `json:"arch"`
	Repo     string `json:"repo"`
	FromRepo string `json:"from_repo"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL