Skip to content

Commit

Permalink
Merge in upstream/main
Browse files Browse the repository at this point in the history
  • Loading branch information
CannonLock committed Nov 19, 2024
2 parents 483dbf0 + 9d1c26f commit bd4bed8
Show file tree
Hide file tree
Showing 59 changed files with 1,199 additions and 962 deletions.
2 changes: 2 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -970,6 +970,7 @@ func SetServerDefaults(v *viper.Viper) error {
v.SetDefault(param.Origin_DbLocation.GetName(), "/var/lib/pelican/origin.sqlite")
v.SetDefault(param.Director_GeoIPLocation.GetName(), "/var/cache/pelican/maxmind/GeoLite2-City.mmdb")
v.SetDefault(param.Registry_DbLocation.GetName(), "/var/lib/pelican/registry.sqlite")
v.SetDefault(param.Director_DbLocation.GetName(), "/var/lib/pelican/director.sqlite")
// The lotman db will actually take this path and create the lot at /path/.lot/lotman_cpp.sqlite
v.SetDefault(param.Lotman_DbLocation.GetName(), "/var/lib/pelican")
v.SetDefault(param.Monitoring_DataLocation.GetName(), "/var/lib/pelican/monitoring/data")
Expand All @@ -980,6 +981,7 @@ func SetServerDefaults(v *viper.Viper) error {
v.SetDefault(param.Origin_DbLocation.GetName(), filepath.Join(configDir, "origin.sqlite"))
v.SetDefault(param.Director_GeoIPLocation.GetName(), filepath.Join(configDir, "maxmind", "GeoLite2-City.mmdb"))
v.SetDefault(param.Registry_DbLocation.GetName(), filepath.Join(configDir, "ns-registry.sqlite"))
v.SetDefault(param.Director_DbLocation.GetName(), filepath.Join(configDir, "director.sqlite"))
// Lotdb will live at <configDir>/.lot/lotman_cpp.sqlite
v.SetDefault(param.Lotman_DbLocation.GetName(), configDir)
v.SetDefault(param.Monitoring_DataLocation.GetName(), filepath.Join(configDir, "monitoring/data"))
Expand Down
1 change: 0 additions & 1 deletion director/director.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,6 @@ func redirectToCache(ginCtx *gin.Context) {
collectDirectorRedirectionMetric(ginCtx, "cache")
}
}()
defer collectDirectorRedirectionMetric(ginCtx, "cache")
err := versionCompatCheck(reqVer, service)
if err != nil {
log.Warningf("A version incompatibility was encountered while redirecting to a cache and no response was served: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/install/macos.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Pelican provides a binary executable file instead of a `DMG` installer for MacOS
Example to install Pelican executable for an Apple Silicon Mac:

```bash
curl -LO https://github.com/PelicanPlatform/pelican/releases/download/v7.10.5/pelican_Darwin_x86_64.tar.gz
curl -LO https://github.com/PelicanPlatform/pelican/releases/download/v7.10.5/pelican_Darwin_arm64.tar.gz
tar -zxvf pelican_Darwin_arm64.tar.gz
```

Expand Down
20 changes: 10 additions & 10 deletions docs/parameters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ description: |+
Subdirectories of the provided directories are not read. Only the root config file's `ConfigLocations` key is used, and any redefinitions are ignored.
type: stringSlice
default: none
default: []
components: ["*"]
---
name: Debug
Expand Down Expand Up @@ -566,7 +566,7 @@ description: |+
This configuration is meant mostly to be used by passing the -v flag from the command line. Paths exported with this
configuration will inherit the origin's abilities, so individual export configurations are not possible.
type: stringSlice
default: none
default: []
components: ["origin"]
---
name: Origin.EnablePublicReads
Expand Down Expand Up @@ -765,7 +765,7 @@ name: Origin.ScitokensRestrictedPaths
description: |+
Enable the built-in issuer daemon for the origin.
type: stringSlice
default: none
default: []
components: ["origin"]
---
name: Origin.ScitokensMapSubject
Expand Down Expand Up @@ -1210,7 +1210,7 @@ description: |+
the cache is allowed to access any namespace that's advertised to the director. Otherwise, it will
only be allowed to access the listed namespaces.
type: stringSlice
default: none
default: []
components: ["cache"]
---
name: Cache.SelfTest
Expand Down Expand Up @@ -1285,7 +1285,7 @@ description: |+
If present, the hostname is taken from the X-Forwarded-Host header in the request. Otherwise, Host is used.
type: stringSlice
default: none
default: []
components: ["director"]
---
name: Director.CacheSortMethod
Expand Down Expand Up @@ -1314,7 +1314,7 @@ description: |+
If present, the hostname is taken from the X-Forwarded-Host header in the request. Otherwise, Host is used.
type: stringSlice
default: none
default: []
components: ["director"]
---
name: Director.MaxMindKeyFile
Expand Down Expand Up @@ -1447,7 +1447,7 @@ description: |+
A list of server resource names that the Director should consider in downtime, preventing the Director from issuing redirects to them.
Additional downtimes are aggregated from Topology (when the Director is served in OSDF mode), and the Web UI.
type: stringSlice
default: none
default: []
components: ["director"]
---
name: Director.SupportContactEmail
Expand Down Expand Up @@ -1489,7 +1489,7 @@ description: |+
This setting allows for compatibility with specific legacy OSDF origins and is not needed for new origins.
type: stringSlice
default: none
default: []
components: ["director"]
hidden: true
---
Expand Down Expand Up @@ -1852,7 +1852,7 @@ description: |+
The "subject" claim should be the "CILogon User Identifier" from CILogon user page: https://cilogon.org/
type: stringSlice
default: none
default: []
components: ["registry","origin","cache"]
---
name: Server.StartupTimeout
Expand Down Expand Up @@ -2477,7 +2477,7 @@ name: Shoveler.OutputDestinations
description: |+
A list of <IP:Port> destinations to forward XRootD monitoring packet to.
type: stringSlice
default: none
default: []
components: ["origin", "cache"]
---
name: Shoveler.VerifyHeader
Expand Down
3 changes: 1 addition & 2 deletions launcher_utils/advertise.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,8 @@ func LaunchPeriodicAdvertise(ctx context.Context, egrp *errgroup.Group, servers
doAdvertise(ctx, servers)

ticker := time.NewTicker(1 * time.Minute)
defer ticker.Stop()
egrp.Go(func() error {

defer ticker.Stop()
for {
select {
case <-ticker.C:
Expand Down
2 changes: 1 addition & 1 deletion oa4mp/resources/policies.qdl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ group_list. := claims.groups;
remove(claims.groups);

{{ if .GroupRequirements }}
if [0 == size(|^group_list. \/ { {{- range $idx, $grp := .GroupRequirements -}}{{- if eq $idx 0 -}}'{{- $grp -}}'{{else}}, '{{- $grp -}}'{{- end -}}{{- end -}} })] then
if [0 == size(|^group_list. /\ { {{- range $idx, $grp := .GroupRequirements -}}{{- if eq $idx 0 -}}'{{- $grp -}}'{{else}}, '{{- $grp -}}'{{- end -}}{{- end -}} })] then
[
sys_err.ok := false;
sys_err.message := 'Authenticated user is not in any of the following groups: {{ range $idx, $grp := .GroupRequirements -}}{{- if eq $idx 0 -}}"{{- $grp -}}"{{else}}, "{{- $grp -}}"{{- end -}}{{- end -}}';
Expand Down
49 changes: 15 additions & 34 deletions web_ui/frontend/app/(login)/initialization/code/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@

'use client';

import { Box, Typography, Grow } from '@mui/material';
import { Box, Typography } from '@mui/material';
import { useRouter } from 'next/navigation';
import { useState } from 'react';
import { useContext, useState } from 'react';

import CodeInput, { Code } from '../../components/CodeInput';
import LoadingButton from '../../components/LoadingButton';
import { getErrorMessage } from '@/helpers/util';
import { initLogin } from '@/helpers/api';
import { alertOnError } from '@/helpers/util';
import { AlertDispatchContext } from '@/components/AlertProvider';

export default function Home() {
const router = useRouter();
Expand All @@ -37,11 +39,11 @@ export default function Home() {
undefined,
]);
let [loading, setLoading] = useState(false);
let [error, setError] = useState<string | undefined>(undefined);

const dispatch = useContext(AlertDispatchContext);

const setCode = (code: Code) => {
_setCode(code);
setError(undefined);

if (!code.includes(undefined)) {
submit(code.map((x) => x!.toString()).join(''));
Expand All @@ -51,26 +53,15 @@ export default function Home() {
async function submit(code: string) {
setLoading(true);

try {
let response = await fetch('/api/v1.0/auth/initLogin', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
code: code,
}),
});

if (response.ok) {
router.push('../password/');
} else {
setLoading(false);
setError(await getErrorMessage(response));
}
} catch {
let response = await alertOnError(
async () => await initLogin(code),
'Could not login',
dispatch
);
if (response) {
router.push('../password/');
} else {
setLoading(false);
setError('Could not connect to server');
}
}

Expand All @@ -97,16 +88,6 @@ export default function Home() {
<form onSubmit={onSubmit} action='#'>
<CodeInput setCode={setCode} length={6} />
<Box mt={2} display={'flex'} flexDirection={'column'}>
<Grow in={error !== undefined}>
<Typography
textAlign={'center'}
variant={'subtitle2'}
color={'error.main'}
mb={1}
>
{error}
</Typography>
</Grow>
<LoadingButton
variant='outlined'
sx={{ margin: 'auto' }}
Expand Down
59 changes: 24 additions & 35 deletions web_ui/frontend/app/(login)/initialization/password/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,43 +20,35 @@

import { Box, Grow, Typography } from '@mui/material';
import { useRouter } from 'next/navigation';
import { useState } from 'react';
import { useContext, useState } from 'react';

import LoadingButton from '../../components/LoadingButton';

import PasswordInput from '../../components/PasswordInput';
import { getErrorMessage } from '@/helpers/util';
import { alertOnError, getErrorMessage } from '@/helpers/util';
import { AlertDispatchContext } from '@/components/AlertProvider';
import { initLogin, resetLogin } from '@/helpers/api';

export default function Home() {
const dispatch = useContext(AlertDispatchContext);

const router = useRouter();
let [password, _setPassword] = useState<string>('');
let [confirmPassword, _setConfirmPassword] = useState<string>('');
let [loading, setLoading] = useState(false);
let [error, setError] = useState<string | undefined>(undefined);

async function submit(password: string) {
setLoading(true);

try {
let response = await fetch('/api/v1.0/auth/resetLogin', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
password: password,
}),
});

if (response.ok) {
router.push('/');
} else {
setLoading(false);
setError(await getErrorMessage(response));
}
} catch {
let response = await alertOnError(
async () => await resetLogin(password),
'Could not login',
dispatch
);
if (response) {
router.push('/');
} else {
setLoading(false);
setError('Could not connect to server');
}
}

Expand All @@ -66,7 +58,16 @@ export default function Home() {
if (password == confirmPassword) {
submit(password);
} else {
setError('Passwords do not match');
dispatch({
type: 'openAlert',
payload: {
alertProps: {
severity: 'warning',
},
message: 'Passwords do not match',
onClose: () => dispatch({ type: 'closeAlert' }),
},
});
}
}

Expand All @@ -89,7 +90,6 @@ export default function Home() {
InputProps: {
onChange: (e) => {
_setPassword(e.target.value);
setError(undefined);
},
},
}}
Expand All @@ -102,7 +102,6 @@ export default function Home() {
InputProps: {
onChange: (e) => {
_setConfirmPassword(e.target.value);
setError(undefined);
},
},
error: password != confirmPassword,
Expand All @@ -112,16 +111,6 @@ export default function Home() {
/>
</Box>
<Box mt={2} display={'flex'} flexDirection={'column'}>
<Grow in={error !== undefined}>
<Typography
textAlign={'center'}
variant={'subtitle2'}
color={'error.main'}
mb={1}
>
{error}
</Typography>
</Grow>
<LoadingButton
variant='outlined'
sx={{ margin: 'auto' }}
Expand Down
Loading

0 comments on commit bd4bed8

Please sign in to comment.