accli 2.0.0b3__tar.gz → 2.0.0b4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. {accli-2.0.0b3 → accli-2.0.0b4}/PKG-INFO +1 -1
  2. {accli-2.0.0b3 → accli-2.0.0b4}/accli/_version.py +1 -1
  3. accli-2.0.0b4/accli/cleanup-nfs.ps1 +55 -0
  4. accli-2.0.0b4/accli/setup-nfs.ps1 +209 -0
  5. {accli-2.0.0b3 → accli-2.0.0b4}/accli.egg-info/PKG-INFO +1 -1
  6. {accli-2.0.0b3 → accli-2.0.0b4}/accli.egg-info/SOURCES.txt +2 -0
  7. {accli-2.0.0b3 → accli-2.0.0b4}/pyproject.toml +3 -0
  8. {accli-2.0.0b3 → accli-2.0.0b4}/LICENSE +0 -0
  9. {accli-2.0.0b3 → accli-2.0.0b4}/README.md +0 -0
  10. {accli-2.0.0b3 → accli-2.0.0b4}/accli/AcceleratorJobProjectService.py +0 -0
  11. {accli-2.0.0b3 → accli-2.0.0b4}/accli/AcceleratorTaskDispatcher.py +0 -0
  12. {accli-2.0.0b3 → accli-2.0.0b4}/accli/AcceleratorTerminalCliProjectService.py +0 -0
  13. {accli-2.0.0b3 → accli-2.0.0b4}/accli/CsvRegionalTimeseriesValidator.py +0 -0
  14. {accli-2.0.0b3 → accli-2.0.0b4}/accli/__init__.py +0 -0
  15. {accli-2.0.0b3 → accli-2.0.0b4}/accli/__main__.py +0 -0
  16. {accli-2.0.0b3 → accli-2.0.0b4}/accli/cli.py +0 -0
  17. {accli-2.0.0b3 → accli-2.0.0b4}/accli/common.py +0 -0
  18. {accli-2.0.0b3 → accli-2.0.0b4}/accli/mount_downloader.py +0 -0
  19. {accli-2.0.0b3 → accli-2.0.0b4}/accli/token.py +0 -0
  20. {accli-2.0.0b3 → accli-2.0.0b4}/accli.egg-info/dependency_links.txt +0 -0
  21. {accli-2.0.0b3 → accli-2.0.0b4}/accli.egg-info/entry_points.txt +0 -0
  22. {accli-2.0.0b3 → accli-2.0.0b4}/accli.egg-info/requires.txt +0 -0
  23. {accli-2.0.0b3 → accli-2.0.0b4}/accli.egg-info/top_level.txt +0 -0
  24. {accli-2.0.0b3 → accli-2.0.0b4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: accli
3
- Version: 2.0.0b3
3
+ Version: 2.0.0b4
4
4
  Summary: IIASA Accelerator Client
5
5
  Author-email: Wrufesh S <wrufesh@gmail.com>
6
6
  License: The MIT License (MIT)
@@ -1,3 +1,3 @@
1
1
  # Please strictly put double quote to use this info for git tag
2
2
  # Read a developer guide for git tag command with regex
3
- VERSION = "v2.0.0-beta.3"
3
+ VERSION = "v2.0.0-beta.4"
@@ -0,0 +1,55 @@
1
+ <#
2
+ .SYNOPSIS
3
+ Reverts all Windows NFS Client and Task Scheduler changes made by setup-nfs.ps1.
4
+ .DESCRIPTION
5
+ This script removes the scheduled task, registry keys, ProgramData configs, and disables
6
+ the native Windows NFS Client features. Useful for testing first-time accli setups.
7
+ .NOTES
8
+ Must be run in an elevated (Administrator) PowerShell window.
9
+ .EXAMPLE
10
+ # Open an Administrator PowerShell window and execute:
11
+ powershell -ExecutionPolicy Bypass -File .\accli\cleanup-nfs.ps1
12
+ #>
13
+
14
+ # Ensure running as Administrator
15
+ $isAdmin = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
16
+ if (-not $isAdmin) {
17
+ Write-Error "This script must be run as Administrator."
18
+ Write-Host "Please open PowerShell as Administrator and run:" -ForegroundColor Yellow
19
+ Write-Host " powershell -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -ForegroundColor Yellow
20
+ exit 1
21
+ }
22
+
23
+ Write-Host "=== Reverting accli Windows NFS Client Configuration ===" -ForegroundColor Cyan
24
+
25
+ # 1. Unregister Scheduled Task
26
+ Write-Host "Removing accli-mount-nfs Scheduled Task..." -ForegroundColor Yellow
27
+ if (Get-Command Unregister-ScheduledTask -ErrorAction SilentlyContinue) {
28
+ Unregister-ScheduledTask -TaskName "accli-mount-nfs" -Confirm:$false -ErrorAction SilentlyContinue | Out-Null
29
+ } else {
30
+ schtasks /delete /tn "accli-mount-nfs" /f 2> $null | Out-Null
31
+ }
32
+ Write-Host "[OK] Scheduled Task removed." -ForegroundColor Green
33
+
34
+ # 2. Delete Registry Policy Keys
35
+ Write-Host "Removing registry policies (EnableLinkedConnections, AnonymousUid, AnonymousGid)..." -ForegroundColor Yellow
36
+ Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "EnableLinkedConnections" -ErrorAction SilentlyContinue | Out-Null
37
+ Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Default" -Name "AnonymousUid" -ErrorAction SilentlyContinue | Out-Null
38
+ Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Default" -Name "AnonymousGid" -ErrorAction SilentlyContinue | Out-Null
39
+ Write-Host "[OK] Registry policies removed." -ForegroundColor Green
40
+
41
+ # 3. Delete Config Folder & Helpers
42
+ Write-Host "Deleting ProgramData configurations..." -ForegroundColor Yellow
43
+ Remove-Item -Path "C:\ProgramData\accli" -Recurse -Force -ErrorAction SilentlyContinue | Out-Null
44
+ Write-Host "[OK] ProgramData folder removed." -ForegroundColor Green
45
+
46
+ # 4. Disable Windows NFS Client features
47
+ Write-Host "Disabling Windows Client for NFS features..." -ForegroundColor Yellow
48
+ if (Get-Command Disable-WindowsOptionalFeature -ErrorAction SilentlyContinue) {
49
+ Disable-WindowsOptionalFeature -Online -FeatureName ServicesForNFS-ClientOnly,ClientForNFS-Infrastructure -NoRestart | Out-Null
50
+ }
51
+ Write-Host "[OK] NFS Client features disabled." -ForegroundColor Green
52
+
53
+ Write-Host ""
54
+ Write-Host "Reversion completed successfully!" -ForegroundColor Green
55
+ Write-Host "⚠ Note: A Windows sign-out/sign-in or system restart is required for changes to take effect." -ForegroundColor Yellow
@@ -0,0 +1,209 @@
1
+ <#
2
+ .SYNOPSIS
3
+ One-time administrative configuration script to enable Windows Client for NFS and register the Task Scheduler Mount Gateway.
4
+ .DESCRIPTION
5
+ This script performs the administrative setup required to allow standard users to mount
6
+ Accelerator project spaces on Windows over NFS with ZERO UAC prompts.
7
+ It can be run silently by IT Administrators using Microsoft Intune, Group Policy (GPO), or SCCM.
8
+ .PARAMETER NfsAlreadyEnabled
9
+ Bypasses enabling NFS Optional features if already enabled.
10
+ .PARAMETER RegAlreadyEnabled
11
+ Bypasses EnableLinkedConnections registry policy creation if already enabled.
12
+ .NOTES
13
+ This script is static and fully auditable by Security and Network Administrators.
14
+ #>
15
+
16
+ param (
17
+ [switch]$NfsAlreadyEnabled,
18
+ [switch]$RegAlreadyEnabled
19
+ )
20
+
21
+ # 1. Enable Windows Client for NFS Optional Features
22
+ if (-not $NfsAlreadyEnabled) {
23
+ Write-Host "Enabling Windows Client for NFS features..." -ForegroundColor Cyan
24
+
25
+ if (Get-Command Enable-WindowsOptionalFeature -ErrorAction SilentlyContinue) {
26
+ # Split into two separate calls to bypass Windows 11 comma-separated feature parser bug
27
+ Enable-WindowsOptionalFeature -Online -FeatureName ServicesForNFS-ClientOnly -All -NoRestart | Out-Null
28
+ Enable-WindowsOptionalFeature -Online -FeatureName ClientForNFS-Infrastructure -All -NoRestart | Out-Null
29
+ } elseif (Get-Command Install-WindowsFeature -ErrorAction SilentlyContinue) {
30
+ # Fallback for Windows Server OS
31
+ Install-WindowsFeature -Name NFS-Client | Out-Null
32
+ }
33
+ Write-Host "[OK] Enabled Client for NFS features." -ForegroundColor Green
34
+ } else {
35
+ Write-Host "[OK] Client for NFS features already enabled." -ForegroundColor Green
36
+ }
37
+
38
+ # 2. Add Registry value for Linked Connections
39
+ # Allows mapped network drives to be shared between elevated and standard sessions under the same user log-in.
40
+ if (-not $RegAlreadyEnabled) {
41
+ Write-Host "Configuring EnableLinkedConnections registry policy..." -ForegroundColor Cyan
42
+
43
+ $regPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System"
44
+ if (-not (Test-Path $regPath)) {
45
+ New-Item -Path $regPath -Force | Out-Null
46
+ }
47
+ New-ItemProperty -Path $regPath -Name "EnableLinkedConnections" -Value 1 -PropertyType DWORD -Force | Out-Null
48
+ Write-Host "[OK] Registry value configured." -ForegroundColor Green
49
+ } else {
50
+ Write-Host "[OK] Registry value already configured." -ForegroundColor Green
51
+ }
52
+
53
+ # 2.5 Configure Anonymous UID/GID to match hf-mount-nfs (UID 0)
54
+ if (-not $RegAlreadyEnabled) {
55
+ Write-Host "Configuring Anonymous UID/GID for NFS Client..." -ForegroundColor Cyan
56
+ $clientForNfsPath = "HKLM:\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Default"
57
+ if (-not (Test-Path $clientForNfsPath)) {
58
+ New-Item -Path $clientForNfsPath -Force | Out-Null
59
+ }
60
+ New-ItemProperty -Path $clientForNfsPath -Name "AnonymousUid" -Value 0 -PropertyType DWORD -Force | Out-Null
61
+ New-ItemProperty -Path $clientForNfsPath -Name "AnonymousGid" -Value 0 -PropertyType DWORD -Force | Out-Null
62
+ Write-Host "[OK] Anonymous UID/GID configured." -ForegroundColor Green
63
+ } else {
64
+ Write-Host "[OK] Anonymous UID/GID registry values already configured (skipped)." -ForegroundColor Green
65
+ }
66
+
67
+ # 3. Create public ProgramData folder and configure permissions for Authenticated Users
68
+ Write-Host "Initializing public accli configuration directory..." -ForegroundColor Cyan
69
+ $configDir = "C:\ProgramData\accli"
70
+ if (-not (Test-Path $configDir)) {
71
+ New-Item -ItemType Directory -Path $configDir -Force | Out-Null
72
+ }
73
+
74
+ try {
75
+ $acl = Get-Acl $configDir
76
+ # Grant Modify (Read, Write, Execute, Delete) to all Authenticated Users so non-admin users can write the mount_config.json
77
+ $ar = New-Object System.Security.AccessControl.FileSystemAccessRule("Authenticated Users", "Modify", "ContainerInherit,ObjectInherit", "None", "Allow")
78
+ $acl.SetAccessRule($ar)
79
+ Set-Acl $configDir $acl
80
+ Write-Host "[OK] Directory permissions configured." -ForegroundColor Green
81
+ } catch {
82
+ Write-Warning "Could not configure ProgramData permissions. Standalone non-admin users might not be able to write configuration."
83
+ }
84
+
85
+ # 4. Write static run-mount-helper.ps1 static helper
86
+ Write-Host "Registering run-mount-helper script..." -ForegroundColor Cyan
87
+ $helperScript = @'
88
+ $configPath = "C:\ProgramData\accli\mount_config.json"
89
+ if (-not (Test-Path $configPath)) {
90
+ Write-Error "Config file not found at $configPath."
91
+ exit 1
92
+ }
93
+
94
+ try {
95
+ $cfg = Get-Content $configPath -Raw | ConvertFrom-Json
96
+ } catch {
97
+ Write-Error "Failed to parse $configPath."
98
+ exit 1
99
+ }
100
+
101
+ # Construct environment
102
+ $env:PATH = "C:\Windows\System32\downlevel;" + $env:PATH
103
+ $env:ACCELERATOR_MOUNT = "1"
104
+ $env:ACC_ENDPOINT = $cfg.server_url
105
+ $env:ACC_CAS_ENDPOINT = "$($cfg.server_url.TrimEnd('/'))/api/xet-cas"
106
+ $env:ACC_TOKEN = $cfg.token
107
+ if ($cfg.skip_auto_mount) {
108
+ $env:HF_MOUNT_SKIP_AUTO_MOUNT = "1"
109
+ }
110
+
111
+ # Construct arguments
112
+ $mountArgs = @(
113
+ "--token-file", $cfg.db_path,
114
+ "--hub-endpoint", $cfg.server_url,
115
+ $cfg.mode,
116
+ $cfg.project_slug,
117
+ $cfg.mount_point
118
+ )
119
+
120
+ if ($cfg.overlay) { $mountArgs += "--overlay" }
121
+ if ($cfg.read_only) { $mountArgs += "--read-only" }
122
+
123
+ # Prepare background logger
124
+ $logFile = "C:\ProgramData\accli\mount.log"
125
+ $errFile = "C:\ProgramData\accli\mount_err.log"
126
+ try {
127
+ # Run the background daemon process elevated (since task runs as SYSTEM)
128
+ & $cfg.hf_mount_bin @mountArgs > $logFile 2> $errFile
129
+ if ($LASTEXITCODE -ne 0 -and $LASTEXITCODE -ne $null) {
130
+ Add-Content -Path $errFile -Value "Process exited with code `$LASTEXITCODE"
131
+ exit `$LASTEXITCODE
132
+ }
133
+ } catch {
134
+ Write-Error "Failed to execute hf-mount-nfs.exe."
135
+ exit 1
136
+ }
137
+ '@
138
+
139
+ $helperScriptPath = "C:\ProgramData\accli\run-mount-helper.ps1"
140
+ Set-Content -Path $helperScriptPath -Value $helperScript -Encoding UTF8
141
+ Write-Host "[OK] Mount helper script registered." -ForegroundColor Green
142
+
143
+ # 5. Register the Scheduled Task (accli-mount-nfs)
144
+ Write-Host "Registering accli-mount-nfs Scheduled Task..." -ForegroundColor Cyan
145
+ $taskName = "accli-mount-nfs"
146
+
147
+ # Helper block executing PowerShell in Task Action
148
+ $psActionPath = "powershell.exe"
149
+ $psActionArgs = "-NoProfile -ExecutionPolicy Bypass -File `"$helperScriptPath`""
150
+
151
+ if (Get-Command Register-ScheduledTask -ErrorAction SilentlyContinue) {
152
+ try {
153
+ $action = New-ScheduledTaskAction -Execute $psActionPath -Argument $psActionArgs
154
+ $principal = New-ScheduledTaskPrincipal -UserId "SYSTEM" -RunLevel Highest
155
+ $settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries
156
+
157
+ # Unregister task if already exists to update
158
+ Unregister-ScheduledTask -TaskName $taskName -Confirm:$false -ErrorAction SilentlyContinue | Out-Null
159
+ Register-ScheduledTask -TaskName $taskName -Action $action -Principal $principal -Settings $settings -Force | Out-Null
160
+
161
+ Write-Host "[OK] Scheduled Task registered successfully." -ForegroundColor Green
162
+ } catch {
163
+ # Fallback to schtasks.exe if cmdlet fails
164
+ schtasks /delete /tn $taskName /f 2> $null | Out-Null
165
+ schtasks /create /tn $taskName /tr "$psActionPath $psActionArgs" /sc ONCE /sd "2026/01/01" /st "00:00" /ru "SYSTEM" /rl "HIGHEST" /f | Out-Null
166
+ Write-Host "[OK] Scheduled Task registered successfully." -ForegroundColor Green
167
+ }
168
+ } else {
169
+ # Legacy fallback
170
+ schtasks /delete /tn $taskName /f 2> $null | Out-Null
171
+ schtasks /create /tn $taskName /tr "$psActionPath $psActionArgs" /sc ONCE /sd "2026/01/01" /st "00:00" /ru "SYSTEM" /rl "HIGHEST" /f | Out-Null
172
+ Write-Host "[OK] Scheduled Task registered successfully." -ForegroundColor Green
173
+ }
174
+
175
+ # Grant Authenticated Users permission to read, query, and run the task file
176
+ $taskFile = "C:\Windows\System32\Tasks\accli-mount-nfs"
177
+ if (Test-Path $taskFile) {
178
+ try {
179
+ $acl = Get-Acl $taskFile
180
+ $rule = New-Object System.Security.AccessControl.FileSystemAccessRule("Authenticated Users", "ReadAndExecute", "Allow")
181
+ $acl.AddAccessRule($rule)
182
+ Set-Acl $taskFile $acl
183
+ Write-Host "[OK] Task file permissions configured (Access allowed for Authenticated Users)." -ForegroundColor Green
184
+ } catch {
185
+ Write-Warning "Could not configure task file permissions. Standard users might not be able to trigger the task without UAC."
186
+ }
187
+ }
188
+
189
+ # Grant Authenticated Users permission to query and trigger the Task Scheduler Service task object itself via COM SDDL
190
+ try {
191
+ $Scheduler = New-Object -ComObject "Schedule.Service"
192
+ $Scheduler.Connect()
193
+ $TaskObject = $Scheduler.GetFolder("\").GetTask("accli-mount-nfs")
194
+ $SDDL = $TaskObject.GetSecurityDescriptor(0xF)
195
+
196
+ # (A;;GRGX;;;AU) grants Read (GR) and Execute (GX) to Authenticated Users (AU)
197
+ if ($SDDL -notmatch 'A;;0x1200a9;;;AU' -and $SDDL -notmatch 'A;;GRGX;;;AU') {
198
+ $SDDL = $SDDL + '(A;;GRGX;;;AU)'
199
+ $TaskObject.SetSecurityDescriptor($SDDL, 0)
200
+ Write-Host "[OK] Task Scheduler COM Service permissions configured for Authenticated Users." -ForegroundColor Green
201
+ } else {
202
+ Write-Host "[OK] Task Scheduler COM Service permissions already configured." -ForegroundColor Green
203
+ }
204
+ } catch {
205
+ Write-Warning "Could not configure Task Scheduler COM permissions: $_"
206
+ }
207
+
208
+ Write-Host "Windows NFS Client Task Scheduler Gateway Setup Completed Successfully!" -ForegroundColor Green
209
+ Write-Host "⚠ Note: A Windows sign-out/sign-in or system restart is required for changes to take effect." -ForegroundColor Yellow
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: accli
3
- Version: 2.0.0b3
3
+ Version: 2.0.0b4
4
4
  Summary: IIASA Accelerator Client
5
5
  Author-email: Wrufesh S <wrufesh@gmail.com>
6
6
  License: The MIT License (MIT)
@@ -8,9 +8,11 @@ accli/CsvRegionalTimeseriesValidator.py
8
8
  accli/__init__.py
9
9
  accli/__main__.py
10
10
  accli/_version.py
11
+ accli/cleanup-nfs.ps1
11
12
  accli/cli.py
12
13
  accli/common.py
13
14
  accli/mount_downloader.py
15
+ accli/setup-nfs.ps1
14
16
  accli/token.py
15
17
  accli.egg-info/PKG-INFO
16
18
  accli.egg-info/SOURCES.txt
@@ -31,6 +31,9 @@ classifiers = [
31
31
  [tool.setuptools]
32
32
  packages = ['accli']
33
33
 
34
+ [tool.setuptools.package-data]
35
+ accli = ["*.ps1"]
36
+
34
37
  [tool.setuptools.dynamic]
35
38
  version = {attr="accli._version.VERSION"}
36
39
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes