Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pve-manager
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
pve-manager
Commits
dab54677
Commit
dab54677
authored
Aug 01, 2013
by
Dietmar Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix changelog url for pve repository
To make it compatible with 'apt-get changelog'
parent
787217cd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
27 deletions
+49
-27
APT.pm
PVE/API2/APT.pm
+28
-9
Subscription.pm
PVE/API2/Subscription.pm
+6
-18
API2Tools.pm
PVE/API2Tools.pm
+15
-0
No files found.
PVE/API2/APT.pm
View file @
dab54677
...
...
@@ -84,7 +84,7 @@ my $get_pkgfile = sub {
};
my
$get_changelog_url
=
sub
{
my
(
$pkgname
,
$info
,
$pkgver
,
$origin
)
=
@_
;
my
(
$pkgname
,
$info
,
$pkgver
,
$origin
,
$component
)
=
@_
;
my
$changelog_url
;
my
$base
=
dirname
(
$info
->
{
FileName
});
...
...
@@ -95,8 +95,13 @@ my $get_changelog_url =sub {
$changelog_url
=
"
http://packages.debian.org/changelogs/
$base
/
"
.
"
${srcpkg}
_
${pkgver}
/changelog
";
}
elsif
(
$origin
eq
'
Proxmox
')
{
$changelog_url
=
"
http://download.proxmox.com/changelogs/
${pkgname}
/
"
.
"
${pkgname}
_
${pkgver}
_changelog
";
if
(
$component
eq
'
pve-enterprise
')
{
$changelog_url
=
"
https://enterprise.proxmox.com/debian/
$base
/
"
.
"
${srcpkg}
_
${pkgver}
.changelog
";
}
else
{
$changelog_url
=
"
http://download.proxmox.com/debian/
$base
/
"
.
"
${srcpkg}
_
${pkgver}
.changelog
";
}
}
}
...
...
@@ -113,9 +118,9 @@ my $assemble_pkginfo = sub {
};
if
(
my
$pkgfile
=
&
$get_pkgfile
(
$candidate_ver
))
{
my
$origin
=
$pkgfile
->
{
Origin
};
$data
->
{
Origin
}
=
$origin
;
if
(
my
$changelog_url
=
&
$get_changelog_url
(
$pkgname
,
$info
,
$candidate_ver
->
{
VerStr
},
$origin
))
{
$data
->
{
Origin
}
=
$pkgfile
->
{
Origin
};
if
(
my
$changelog_url
=
&
$get_changelog_url
(
$pkgname
,
$info
,
$candidate_ver
->
{
VerStr
},
$pkgfile
->
{
Origin
},
$pkgfile
->
{
Component
}
))
{
$data
->
{
ChangeLogUrl
}
=
$changelog_url
;
}
}
...
...
@@ -366,7 +371,7 @@ __PACKAGE__->register_method({
my
$url
;
die
"
changelog for '
${pkgname}
_
$ver
->{VerStr}' not available
\n
"
if
!
(
$pkgfile
&&
(
$url
=
&
$get_changelog_url
(
$pkgname
,
$info
,
$ver
->
{
VerStr
},
$pkgfile
->
{
Origin
})));
if
!
(
$pkgfile
&&
(
$url
=
&
$get_changelog_url
(
$pkgname
,
$info
,
$ver
->
{
VerStr
},
$pkgfile
->
{
Origin
}
,
$pkgfile
->
{
Component
}
)));
my
$data
=
"";
...
...
@@ -377,13 +382,27 @@ __PACKAGE__->register_method({
$ua
->
agent
("
PVE/1.0
");
$ua
->
timeout
(
10
);
$ua
->
max_size
(
1024
*
1024
);
$ua
->
ssl_opts
(
verify_hostname
=>
0
);
# don't care for changelogs
if
(
$proxy
)
{
$ua
->
proxy
(['
http
'],
$proxy
);
$ua
->
proxy
(['
http
'
,
'
https
'
],
$proxy
);
}
else
{
$ua
->
env_proxy
;
}
my
$username
;
my
$pw
;
if
(
$pkgfile
->
{
Origin
}
eq
'
Proxmox
'
&&
$pkgfile
->
{
Component
}
eq
'
pve-enterprise
')
{
my
$info
=
PVE::INotify::
read_file
('
subscription
');
if
(
$info
->
{
status
}
eq
'
Active
')
{
$username
=
$info
->
{
key
};
$pw
=
PVE::API2Tools::
get_hwaddress
();
$ua
->
credentials
("
enterprise.proxmox.com:443
",
'
pve-enterprise-repository
',
$username
,
$pw
);
}
}
my
$response
=
$ua
->
get
(
$url
);
if
(
$response
->
is_success
)
{
...
...
PVE/API2/Subscription.pm
View file @
dab54677
...
...
@@ -35,18 +35,6 @@ my $localkeydays = 15;
my
$allowcheckfaildays
=
5
;
my
$shared_key_data
=
"
kjfdlskfhiuewhfk947368
";
my
$hwaddress
;
sub
get_hwaddress
{
return
$hwaddress
if
defined
(
$hwaddress
);
my
$fn
=
'
/etc/ssh/ssh_host_rsa_key.pub
';
my
$sshkey
=
PVE::Tools::
file_get_contents
(
$fn
);
$hwaddress
=
uc
(
md5_hex
(
$sshkey
));
return
$hwaddress
;
}
sub
get_sockets
{
my
$info
=
PVE::ProcFSTools::
read_cpuinfo
();
...
...
@@ -147,7 +135,7 @@ sub read_etc_pve_subscription {
die
"
checksum failure
\n
"
if
$csum
ne
$newcsum
;
my
$req_sockets
=
get_sockets
();
my
$server_id
=
get_hwaddress
();
my
$server_id
=
PVE::API2Tools::
get_hwaddress
();
check_fields
(
$localinfo
,
$server_id
,
$req_sockets
);
...
...
@@ -176,8 +164,8 @@ sub read_etc_pve_subscription {
sub
write_apt_auth
{
my
$key
=
shift
;
my
$server_id
=
get_hwaddress
();
my
$auth
=
{
'
enterprise.proxmox.com
'
=>
{
login
=>
$key
,
password
=>
get_hwaddress
()
}
};
my
$server_id
=
PVE::API2Tools::
get_hwaddress
();
my
$auth
=
{
'
enterprise.proxmox.com
'
=>
{
login
=>
$key
,
password
=>
$server_id
}
};
PVE::INotify::
update_file
('
apt-auth
',
$auth
);
}
...
...
@@ -208,7 +196,7 @@ sub check_subscription {
my
$uri
=
"
$whmcsurl
/modules/servers/licensing/verify.php
";
my
$server_id
=
get_hwaddress
();
my
$server_id
=
PVE::API2Tools::
get_hwaddress
();
my
$req_sockets
=
get_sockets
();
...
...
@@ -297,7 +285,7 @@ __PACKAGE__->register_method ({
code
=>
sub
{
my
(
$param
)
=
@_
;
my
$server_id
=
get_hwaddress
();
my
$server_id
=
PVE::API2Tools::
get_hwaddress
();
my
$info
=
PVE::INotify::
read_file
('
subscription
');
if
(
!
$info
)
{
...
...
@@ -384,7 +372,7 @@ __PACKAGE__->register_method ({
};
my
$req_sockets
=
get_sockets
();
my
$server_id
=
get_hwaddress
();
my
$server_id
=
PVE::API2Tools::
get_hwaddress
();
check_fields
(
$info
,
$server_id
,
$req_sockets
);
...
...
PVE/API2Tools.pm
View file @
dab54677
...
...
@@ -2,6 +2,21 @@ package PVE::API2Tools;
use
strict
;
use
warnings
;
use
PVE::
Tools
;
use
Digest::
MD5
qw(md5_hex)
;
my
$hwaddress
;
sub
get_hwaddress
{
return
$hwaddress
if
defined
(
$hwaddress
);
my
$fn
=
'
/etc/ssh/ssh_host_rsa_key.pub
';
my
$sshkey
=
PVE::Tools::
file_get_contents
(
$fn
);
$hwaddress
=
uc
(
md5_hex
(
$sshkey
));
return
$hwaddress
;
}
sub
extract_node_stats
{
my
(
$node
,
$members
,
$rrd
)
=
@_
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment