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

implementation of daemon option in agent #22

Merged
merged 13 commits into from
Oct 11, 2022
Merged

Conversation

alknopfler
Copy link
Contributor

@alknopfler alknopfler commented Oct 10, 2022

Contains:

  • Basic structure of commands and flags using the first option passing arguments instead of retrieving the information using api, tpm and so on...
  • definition of daemon (full end2end for the agent) before splitting into enable, disable, run and status
  • adding the bootstrap url retrieve step (from dhclient.leases)

Alberto Morgante and others added 7 commits October 8, 2022 07:54
Signed-off-by: Alberto Morgante Medina <alknopfler@users.noreply.github.com>
Signed-off-by: Alberto Morgante Medina <alknopfler@users.noreply.github.com>
Signed-off-by: Alberto Morgante Medina <alknopfler@users.noreply.github.com>
Signed-off-by: Alberto Morgante Medina <alknopfler@users.noreply.github.com>
Signed-off-by: Alberto Morgante Medina <alknopfler@users.noreply.github.com>
@alknopfler alknopfler marked this pull request as ready for review October 10, 2022 14:59
@alknopfler alknopfler requested a review from a team as a code owner October 10, 2022 14:59
Signed-off-by: Alberto Morgante Medina <alknopfler@users.noreply.github.com>
Signed-off-by: Alberto Morgante Medina <alknopfler@users.noreply.github.com>
func (a *Agent) prepareEnvDaemon() error {
log.Println("[INFO] Get the Bootstrap URL from DHCP client")

if _, err := os.Stat(DHCLIENT_LEASE_FILE); err == nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need to do this in a loop, because it takes time to get a lease from DHCP server...

)

const (
DHCLIENT_LEASE_FILE = "/var/lib/dhclient/dhclient.leases"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we might do it a separate file so we can have logic for both: DHCP, mDNS and SLAAC
wdyt ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WDYM?
instead of the loop looking this:

if _, err := os.Stat(DHCLIENT_LEASE_FILE); err == nil {
		line := linesInFileContains(DHCLIENT_LEASE_FILE, SZTP_REDIRECT_URL)
		a.BootstrapURL = extractURLfromLine(line, `(?m)[^"]*`)
		log.Println(a)

have a function to look 3 sources (dhclient.leases, slaac and mdns) to know where's the change and continue with this change?

Signed-off-by: Alberto Morgante Medina <alknopfler@users.noreply.github.com>
@glimchb glimchb changed the title [WIP] implementation of daemon option in agent implementation of daemon option in agent Oct 11, 2022
Signed-off-by: Alberto Morgante Medina <alknopfler@users.noreply.github.com>
@glimchb glimchb merged commit e1c655e into opiproject:main Oct 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants